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

getOption() in JS code

Avatar

Avatar
Boost 5
Level 2
ramprakasht3196
Level 2

Likes

9 likes

Total Posts

42 posts

Correct Reply

0 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
View profile

Avatar
Boost 5
Level 2
ramprakasht3196
Level 2

Likes

9 likes

Total Posts

42 posts

Correct Reply

0 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
View profile
ramprakasht3196
Level 2

16-06-2020

Hi all,

 

We are using Javascript code for sms delivery. The URL used in the script is different for development and production. So I am planning to save the URL in option and this will be called in JS code using getOption(). When triggering sms delivery using the Javascript Iam getting below error

 

" getOption is not defined"

 

Same code I tried in Workflow using javascript activity, I can able see the option value in logInfo().

 

Could you please tell me what will be the issue.

 

Thanks,

Ram 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

161 likes

Total Posts

380 posts

Correct Reply

134 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile

Avatar
Contributor
MVP
Milan_Vucetic
MVP

Likes

161 likes

Total Posts

380 posts

Correct Reply

134 solutions
Top badges earned
Contributor
Springboard
Shape 1
Validate 25
Validate 10
View profile
Milan_Vucetic
MVP

16-06-2020

Hi @ramprakasht3196

include these libraries on the script beginning and try again.

loadLibrary("xtk:shared/nl.js");
loadLibrary("xtk:shared/xtk.js");
loadLibrary("xtk:shared/json2.js");
loadLibrary("xtk:common.js");

Regards,

Milan

 

 

Answers (1)

Answers (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 @ramprakasht3196,

 

You cannot use option variables inside your SMS 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 SMS delivery, or in the initialisation script of your SMS delivery activity as something like this:

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

 

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

 

Thanks,

Ishan