Include option value in string

Avatar

Avatar
Validate 1
Level 1
roro_coeur
Level 1

Likes

2 likes

Total Posts

22 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
roro_coeur
Level 1

Likes

2 likes

Total Posts

22 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
roro_coeur
Level 1

19-06-2020

Hello,

 

In a delivery template, is it possible to get the value of an option without using an include (<%@ include option='myOption' %>)?

I actually need to include an option in a javasript string :

 

<%

var string = "Hello, blabla: [option]";

%>

 

Thank you for your help,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 2
isahore
Level 2

Likes

8 likes

Total Posts

36 posts

Correct reply

11 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile

Avatar
Boost 5
Level 2
isahore
Level 2

Likes

8 likes

Total Posts

36 posts

Correct reply

11 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 5
Affirm 3
View profile
isahore
Level 2

20-06-2020

Hi @roro_coeur,

 

You cannot use option variables inside your delivery as the MTA does not get the options from your marketing instance, and also does not support the GetOption() method.

You will need to read the option variable in a js activitiy prior to the delivery, or in the initialisation script of your delivery activity as something like this:

var.thisOption = getOption("readMyValue"); //readMyValue is an example option variable name

 

Then use it in your delivery activity as you want it: <%= vars.thisOption %>

 

Thanks,

Ishan

Answers (1)

Answers (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

977 likes

Total Posts

1,096 posts

Correct reply

516 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

19-06-2020

Hi,

 

<%
var string = "Hello, blabla: " + getOption('[option]');
%>

 

Thanks,

-Jon