Include option value in string

roro_coeur

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)

isahore

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)

wodnicki

MVP

19-06-2020

Hi,

 

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

 

Thanks,

-Jon