V7: Calling functions in control typology rule | Community
Skip to main content
Level 2
December 31, 2024
Solved

V7: Calling functions in control typology rule

  • December 31, 2024
  • 1 reply
  • 504 views

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)) %>";

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manoj_Kumar

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.

1 reply

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
January 16, 2025

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  | https://themartech.pro
Level 2
January 16, 2025

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