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

V7: Calling functions in control typology rule

  • December 31, 2024
  • 1 reply
  • 500 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)) %>";

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_
_Manoj_Kumar_Accepted solution
New Participant
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     Find me on LinkedIn
New Participant
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