Personalization field in script | Community
Skip to main content
filipe23353816
Level 2
June 15, 2021
Solved

Personalization field in script

  • June 15, 2021
  • 1 reply
  • 1436 views

Hi,

I have a script in an email template which I want to populate with the name and email of the recipient. How may I do that? See the script below where I have tried to add the personalization field but I am not sure of the format. Now it will just be formatted as text.

<script type="application/json+trustpilot">
{
"recipientName": "<span class="acr-field nl-dce-field" data-nl-expr="/context/targetData/name" data-nl-type="string" contenteditable="false">Name (name)</span>",
"recipientEmail": "<span class="acr-field nl-dce-field" data-nl-expr="/context/targetData/email" data-nl-type="string" contenteditable="false">Email (email)</span>"
}
</script>

 

Br

Filip

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jamal

Hi Filip, 

 

The notation you used is generally just for email content, you may want to call the variables using this format instead:

Where firstname: <%= context.targetDate.name%> .

 

In the script that would be:

 

<script type="application/json+trustpilot">
{
"recipientName": "<%= context.targetDate.name%>",
"recipientEmail": "<%= context.targetDate.email%>"}
</script>

 

This is the way variables are called in Campaign Classic, and I've used it with success in Standard too. 

Please let me know how it goes.

 

Cheers,

Jamal

1 reply

jamalAccepted solution
Level 2
June 17, 2021

Hi Filip, 

 

The notation you used is generally just for email content, you may want to call the variables using this format instead:

Where firstname: <%= context.targetDate.name%> .

 

In the script that would be:

 

<script type="application/json+trustpilot">
{
"recipientName": "<%= context.targetDate.name%>",
"recipientEmail": "<%= context.targetDate.email%>"}
</script>

 

This is the way variables are called in Campaign Classic, and I've used it with success in Standard too. 

Please let me know how it goes.

 

Cheers,

Jamal

filipe23353816
Level 2
June 21, 2021
Thanks Jamal, that worked perfectly!