Personalize a Message For Your Users
This article provides step-by-step instructions on how to add a customized message based on the current logged-in user. In order 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.
The first step is to note the exact fieldname(s) you’d like to reference. Open the authentication table or view that was used to password protect your DataPage. Locate the field(s) you want to reference in your message. Copy their fieldnames for future reference. In this example we are going to pull the First_Name field.
- Navigate to the DataPages listing in the app, select the DataPage you would like to change, and click Edit.
- Proceed to the DataPage DataSource screen. Check Enable Advanced Options and Enable parameters.
- Restrict access to the DataPage through Authentication.
- Proceed to a Configure Fields screen. Web Forms have only one Configure Fields screen, but Search and Report Pages have three (search, results and details pages).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 into the header section. Click the Insert button at the lower right corner of the DataPage Elements panel. Click Header & Footer to insert these sections.
- Inside the header section, you construct your authenticated parameter.First, you type out a parameter. You can pull data directly from the authentication table (or view) by creating a parameter using the following format: [@authfield:FiledName]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].
- Next, 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 current logged-in user). Some HTML formatting has also been added.
- Click Finish to save the DataPage.
- Preview your message either directly in Caspio Bridge or on your webpage to verify formatting and placement are as expected.
Having Difficulty? Check Here:
- Are parameters enabled in the DataPage?
- Is the parameter formatted correctly. Here's the correct format: [@authfield:xxxxx]
- Does the authentication table or view have data in that field?
Personalized messages are an impressive piece of polish to add to your apps. This is one example of how to use parameters to customize your DataPages. If you were able to create a personalized message, you may want to take a look at some of the other things that can be accomplished using parameters. Read more About Parameters.