Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Execute JS in subject variable

Avatar

Avatar
Validate 1
Level 1
rorocoeur
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
rorocoeur
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
rorocoeur
Level 1

04-12-2017

Hello,

In a delivery template, in the text version, we use this code to retrieve the subject dynamically:

<% document.write(delivery.mailParameters.subject); %>

The problem is that if there is javascript inside the subject, it is not executed.

For instance, if the subject is : <%=recipient.firstName%>, how are you doing?

It won't execute the firstname variable and will display the all thing as plain text.

Is there any means for avoing this issue?

Thank you very much for your help!

View Entire Topic

Avatar

Avatar
Boost 5
Level 2
christophec3473
Level 2

Likes

10 likes

Total Posts

8 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 3
View profile

Avatar
Boost 5
Level 2
christophec3473
Level 2

Likes

10 likes

Total Posts

8 posts

Correct Reply

4 solutions
Top badges earned
Boost 5
Boost 3
Boost 10
Boost 1
Affirm 3
View profile
christophec3473
Level 2

15-12-2017

Hi,

If you use a typologie rule which consider the content of your delivery text content, you will able to add your script in this content.

//script in your rule

var txtStr = delivery.content.text.source;

delivery.content.text.source = '<% document.write(delivery.mailParameters.subject); %>' + txtStr;

Return true;

I don't know if your Javascript don't work in the text context but, it's ok in the html context.

This answer can help you ?

Christophe