After clicking Create Token, a window appears, where you can select the type of token to be created.
With Relational Data, you can use your own, business-specific data in combination with data stored by Emarsys to populate personalization variables. If you, as a pre-requisite, have added reference fields that connect your database to ours, you will be able to select the variables you have created and the fields belonging to it.
As a pre-requisite to creating Relational data tokens, you need to have a Relational Data preset to be used.
Creating a new Relational Data preset
In the Create Token window, click New in the Relational Data preset line, which opens the Create RDS Preset window.
- Name your RDS preset. You will have to use this name to reference your preset during token creation, therefore, it is worth using a descriptive name.
- Select the database connection.
- Select the desired table or view.
Reference fields are used to create views for RDS presets. Be aware that you need to set up sorting for your reference fields when expecting multiple results for your personalization. For more information, see Sorting fields.
- Set the available parameters, by editing their Type and Value.
- Contact Field:
- Use this type to match your reference field to a field in the Emarsys data base. This ensures that the right people receives the right value when the personalization token is used.
- Use this type to enter a value present in your database. By entering a single value, you can filter for a category. For example, the customer database has data for all product categories, but we are only interested in data for one of them.
- External Event:
- Use the external event parameter when you want your personalization token set by data in the JSON file of an external event. The external event parameter has the following values:
- Event: Select the relevant event name.
- Variable: Each JSON object can be selected as a variable.
- These JSON objects need to be created in Content > Personalization > External Data > Create Token. Send the External Events containing these JSON objects with the Activate External Event Trigger API call.
- When the external event is triggered, the received objects can be used to filter data in the selected table or connection.
Now, you are ready to create the Relational Data token.
Creating a Relational Data token
- Give a descriptive name to your token to make it easier to find it while using a content editor.
- Select the category you want to add the token to. A single token can be used in more than one category. You can also create a new category, for more information, see Creating a token category.
- Select the Relational data preset that will be used for the token. You can select and Edit one of your previous presets or even create a New one. Use one of your existing connections and select a table or a view. Continue with setting the parameters available for the connection and the table/view.
- Select the field of the preset that will be used to populate the token.
- This line shows a preview of the token and the Emarsys Scripting Language code that is used for it. This code can be copied and inserted into blocks, too. For more information on ESL, see Emarsys Scripting Language.
- The item index selects the item to be used from the array. Please note that the list starts with "0", so this means the first item, "1" denotes the second, "2" the third and so on. Use this option to choose from the values, when your database return multiple results to query.
- Check this box if you want to make sure that the message is not sent out if the personalization token cannot be populated.
- Add a fallback text that will be displayed if the value of the field cannot be obtained for some reason. Using a fallback text and marking the field as a requirement for sending are mutually exclusive.
- Here, you can add the formatting details of the token.
Note the information box about display settings override: this means that the settings you make here can be later overridden if needed at campaign-level.