Expand my Community achievements bar.

V7: Calling functions in control typology rule

Avatar

Level 2

We are creating the unsubscription link with at typology rule, where we would need to get a value into the unsubscription link which is based on some recipient field, but calculated in a function.

 

So we wrote a function that could for example make some hashing etc, but trying to call the function causes an error 'createKey is not defined', or 'recipient is not defined'.


Tried to run the typology rule in different phases like at the start of targeting, after targeting etc but no differece.
Is there some syntax error or is this possible in the first place?

function createKey(customerKey) {
  var hashedKey;
  //do something
  return hashedKey;
}

And how we tried to call: 

 

var headerUnsubUrl = "https://our.campaign.adobe.com/webApp/unsub1Click?id=<%= recipient.cryptedId %>&unsubkey=<%= (createKey(recipient.customerKey)) %>";

2 Replies

Avatar

Community Advisor

Hello @terol73355739 

 

My suggestion would be to move this logic outside of typology otherwise the delivery will take a lot of time to process this logic.

 

The best way would be to move this logic to a technical workflow and create an attribute in recipient schema to save the hashed value and then use can easily select the attribute in a delivery.


     Manoj
     Find me on LinkedIn

Avatar

Level 2

Thank you, you're right about processing. We actually do have such technical workflow which calculates a "hash" for recipients. But there may be newly created recipients who don't have the calculation run yet. You could of course do the calculation for those recipients in the workflow just before delivery but it would be an extra node

Thanks, 

 Tero