How to use globally stored (Platform>>Options) value inside a Delivery activity

Avatar

Avatar

tarung68540960

Avatar

tarung68540960

tarung68540960

10-03-2016

We are trying to encrypt the ID of the recipient using DES before using it inside an anchor <a></a> tag. And getting the error as described below.

It seems that the method getOption is not available inside the delivery content javascript. We don't want hard coded value there

We thought about using the Delivery >> Properties >> Variables

But for that we have to set the variable in the activity connecting the delivery. Or there has to be some way to set the value of the variable inside the delivery activity after reading from the options. If there is such option, we are ok with that as well.

Also referred to the below document for implementation, but it is not working.

https://docs.campaign.adobe.com/doc/AC6.1/en/Technotes/AdobeCampaign_How_to_send_personalized_secure...

Here is the workflow created for test purpose

Workflow.PNG

The script inside Delivery content:

<%

  var baseURL = getOption("lbkUSAFindNohURL")

  var key = getOption("lbkUSADESKey");

  var cipherMode= getOption("lbkUSADESCipherMode")

  var intiVector = getOption("lbkUSADESIV")

  var padding = getOption("lbkUSADESPadding")

  var encryptedVal = encryptDES(key,recipient.id,cipherMode,intiVector,padding)

  var unSubURl = baseURL + "/unsubscribe?docId=" + escapeUrl(encryptedVal)

%>

And here is how the link inside the html looks:
<a href="<%= unSubURl %>" style="color: #7293C0">here</a>

03/10/2016 9:21:09 AM  Failed    Unreachable      xxxx@yyy.com     Error while compiling script 'content htmlContent' line 4: getOption is not defined. JavaScript: error while evaluating script 'content htmlContent'.

getOption_error.PNG

Tried to use variable:
Added these lines in the advanced tab of the Query activity:
vars.baseURL = getOption("lbkUSAFindNohURL")

  vars.key = getOption("lbkUSADESKey");

  vars.cipherMode= getOption("lbkUSADESCipherMode")

  vars.intiVector = getOption("lbkUSADESIV")

  vars.padding = getOption("lbkUSADESPadding")

And changed the delivery as below:

<%

  var baseURL = vars.baseURL

  var key = vars.key

  var cipherMode= vars.cipherMode

  var intiVector = vars.intiVector

  var padding = vars.padding

  var encryptedVal = encryptDES(key,recipient.id,cipherMode,intiVector,padding)

  var unSubURl = baseURL + "/unsubscribe?docId=" + escapeUrl(encryptedVal)

%>

Getting this error now:

03/10/2016 9:29:34 AM  Failed    Unreachable xxxx@yyyy.com  Error while compiling script 'content htmlContent' line 4: vars is not defined. JavaScript: error while evaluating script 'content htmlContent'.

Vars_Error.PNG

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar

GowtamiMohanty

Employee

Avatar

GowtamiMohanty

Employee

GowtamiMohanty
Employee

12-09-2018

The syntax to access options is different for landing page and a delivery.

For Delivery:

<span>  <%@ include option='NmsServer_IntranetURL' %></span>

For Landing page:

<span><%= getOption('NmsServer_IntranetURL') %></span>