External data
This topic describes how to process external data using field functions.
Use your specific data and recipient list fields, and test the field functions before using them in a mailing.
Displaying a JSON string as text in a mailing
If you retrieve data via API and store it as a JSON string, you can display the content as text with the following velocity code:
If recipient list fields contain data as JSON, you can display the content as text using the following velocity code:
Example
You have a recipient list with a custom field in text format that contains the following JSON string:
{"clearname": "John Smith", "unsubscribelink": "http://www.example.com/unsubscribe/user-id-1234"}
In the mailing, you can use the JSON string using velocity code as follows:
Displaying post-click data
Velocity lets you access the following post-click data and display it in a mailing:
- service ("name_of_service")
- stringValue("x")
- is()
- isNot()
- floatValue("X")
- isGreaterThan("y")
- isLessThan("y")
- isGreaterThanOrEqualTo("y")
- isLessThanOrEqualTo("y")
Using velocity field functions, you can display only the most recent post-click data. You cannot display older data.
Example
The following Velocity code lets you display the value of gvalue10 in the serviceName service: