%%[ SET @subscriberKey = AttributeValue('ContactKey') /* IS Triggered Products Parse */ SET @triggerRecommendationJson = AttributeValue('Trigger_Catalog_Items')
]%%
<script runat="server">
Platform.Load("Core","1");
try {
var triggerCatalogItems = Platform.Variable.GetValue('@triggerRecommendationJson');
var payloadObj = Platform.Function.ParseJSON(triggerCatalogItems);
var numProductsTrigger = payloadObj.length;
var subKey = Platform.Variable.GetValue('@subscriberKey');
if(numProductsTrigger > 0) {
var catalogItem = payloadObj[0]
var productName = catalogItem.name
Platform.Variable.SetValue('@productAvailableCount', numProductsTrigger);
Platform.Variable.SetValue('@productName', productName);
var rows = Platform.Function.UpsertData("audience for test push",["ContactKey"],[subKey],["productName"],[productName]);
}
Write(1);
}
catch(e) {
Write(Stringify(e.message) + Stringify(e.description))
}
</script>
%%[
SET @subscriberKey = AttributeValue('ContactKey')
/* IS Triggered Products Parse */
SET @triggerRecommendationJson = AttributeValue('Trigger_Catalog_Items')
]%%
<script runat="server">
Platform.Load("Core","1");
try {
var triggerCatalogItems = Platform.Variable.GetValue('@triggerRecommendationJson');
var payloadObj = Platform.Function.ParseJSON(triggerCatalogItems);
var numProductsTrigger = payloadObj.length;
var subKey = Platform.Variable.GetValue('@subscriberKey');
if(numProductsTrigger > 0) {
var catalogItem = payloadObj[0]
var productName = catalogItem.name
Platform.Variable.SetValue('@productAvailableCount', numProductsTrigger);
Platform.Variable.SetValue('@productName', productName);
var rows = Platform.Function.UpsertData("audience for test push",["ContactKey"],[subKey],["productName"],[productName]);
}
Write(1);
}
catch(e) {
Write(Stringify(e.message) + Stringify(e.description))
}
</script>