Pass key-value object to display content in recurring delivery
Hello,
I'm trying to pass dictionary key-value object to display personalized content in recurring delivery and I'm not sure how to do so.
General idea is that first I'm querying my database and then I'm using javascript activity to:
1. Get customerIds from targetSchema
2. Do some calculations through third party API
3. Save the results in key-value pairs, one value per one recipient, for example:
var dictionary = {
'customerId021': 'value1',
'customerId525': 'value2',
'customerId333': 'value3'
};
up to this point everything is fine and now I wanted to pass this object to vars event variable to use it in recurring delivery activity, so in my javascript I did the following:
vars.contentDictionary = dictionary;and in my delivery I was planning to do something as follows:
<%= vars.contentDictionary.consumerId %>so the content would display different value per each user based on his consumerId.
Unfortunately this is not working as expected as after the line:
vars.contentDictionary = dictionary;this new object is not working in the same way as previous javascript object:
logInfo(vars.contentDictionary);
>> 04/29/2025 10:53:10 AM js [object Object]for each (var e in vars.contentDictionary)
{
logInfo(vars.contentDictionary[e]);
}
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
>> 04/29/2025 10:53:10 AM js undefined
So basically I can't figure out how to get specific values from this object after putting it in event variable and also I'm not sure if I can simply use it in recurring delivery activity which follows the javascript or I should perform some extra steps? Any help will be appreciated.