This article provides step-by-step instructions on how to add a customized message based on the currently logged-in user. For this message to be created, your DataPage must be authenticated. You will be using parameters to pull information from the authentication table to display it directly to the end-user. This technique can be used for any field in your authentication table and on any authenticated DataPage. In this example, you pull in the first name of the logged-in user and display a custom greeting to that user.
- Note the exact fieldname(s) you want to reference.
- Open the authentication table or view that was used to password protect your DataPage.
- Copy the fieldnames you want to reference in your message. In this example, we are going to pull the First_Name field.
- Edit a DataPage you would like to change. Apply the following configurations:
- Restrict access to the DataPage through Authentication.
- Proceed to a Configure Fields screen. You can add parameters into any portion of a DataPage including header and footers, HTML blocks, labels, etc. In this example, you add a greeting to the header section.
- Insert Header & Footer.
- Inside the header section, construct your authenticated parameter. You can pull data directly from the authentication table (or view) by creating a parameter using the following format: [@authfield:FieldName]. It is important that “authfield:” is included before the fieldname. This tells the DataPage to pull the data from the authentication table (or view) and not from the base table. In this example, the parameter would be [@authfield:First_Name].
- Write a message using the new parameter. In this example we are pulling the first name data to say, “Hi, John! Here are today’s Inquiries:” (John will be replaced dynamically with the first name of the currently logged-in user). Some HTML formatting has also been added.
- Save the changes.
- Optional: Preview your message either directly in Caspio or on your webpage to verify formatting and placement are as expected.