Troubleshooting for Transact XML Message Scripting

Read this section to learn how to resolve message scripting issues in your transactional emails.

Issue with numeric or boolean helpers

You’re having problems trying to do numeric or boolean equality checks or comparisons. How can this be resolved?
Use JSON scripting context, instead of XML personalization fields. If you are using AGE, enter a numeric number in the JSON scripting context.
Example with code

{{#xif ‘Age >= 18’ }}Vote!{{/xif}}

Example with context

{“Age” : “3”}, the result would be “Vote!”

Example with context

With context {“Age”: 3}, the result would be empty string

Scripted personalization does not show in the transactional email.

Verify the following items to resolve this issue:

  • Is the field in your context (either JSON or XML personalization field)?
  • Does the field name case match between your scripted code and your context data?

Other known limitations for message scripting personalization:

1.You can only personalize untracked links with message scripting.
Personalizing any tracked link with message scripting will not work. The click handling code of tracked links does not support resolving message scripting personalization.

2.You cannot nest message scripting within a classic personalization field.
For example, the following will not work:

%%Field-1 {{PERS_FIELD_2}} End-Field-1%%

3.You cannot nest message scripting within a message scripting field.
For example, if you have PERS_FIELD_1 in your email, the value of PERS_FIELD_1 cannot be nested as follows:

Value for Personalization Field 1* {{PERS_FIELD_2}}

Error: Too many tokens found, expecting [number] in expression [expression]

Recommended
The shortdesc element is optional and can be either on its own or inside an element.
This error is generated from the code. For example:

{{#xif ‘PERSON AGE >= 18’ }}Make sure you vote!{{else}}No voting yet{{/xif}}
  • Do not include a space in PERSON AGE in the xif expression.
  • Trying to use quotes around PERSON AGE in the expression does not resolve the problem.For example, suppose you have the code:
{{#xif ‘”PERSON-AGE” >= 18’ }}Make sure you vote!{{else}}No voting yet{{/xif}}
  • A context of {"PERSON-AGE": 21} results in an error: "PERSON-AGE" was not found in the current context. This error occurs because it is literally expecting "PERSON_AGE" with the quotes to be the field name in the scripting context.
  • A context of {'"PERSON-AGE"': 21} (where PERSON_AGE is surrounded by double quotes within single quotes) renders the scripting xif code without error.

User response: Optional. When you have particular actions that are performed by particular users, use one or more of the ts*Response elements.