Skip to main content
Level 2
Nov 9, 2022 3:09 PM UTC
Question

Direct Mail Output failing to Add <%= message.cellId %> to output syntax

Hello, The DM Delivery output script is consistently failing to compile when adding any type of variables to the output script (Ex: <%= vars.campaignId %>_<%= vars.workflowId %>_<%= vars.lastSync %>). I've also tried updating the script syntax in the DM template then echoing it to the recurring delivery in the campaign but still failing with errors below. One think I noticed is that whatever variable we add to the script output file, it’s always defaulting to <%= message.cellId %> in the output file external config. The following is the output name I want to achieve ==> DirectMail_2022-10-19_12-48-34-000_3262771_3453765_2210191231.txt. Any feedback would be greatly appreciated.

 

Screenshots:

 

Thanks,

Soph

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

12 replies

ParthaSarathy
Community Advisor
Community Advisor
Nov 11, 2022 8:13 AM UTC

Hi @soph75 ,

Configure the below script in Delivery activity's script tab

var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@internalName"/></select><where><condition expr={"@id = '"+instance.operation_id+"'"}/></where></queryDef>); var eventExistss = query.ExecuteQuery(); for each (var eventT in eventExistss.operation){ instance.vars.CampaignId = eventT.@id;}

delivery.variables._var[0].stringValue=instance.vars.CampaignId;

delivery.variables._var[1].stringValue=instance.id;

And in Delivery Property > Variable Tab,

Add > Name: CampaignId > ok

Add > Name: workflowId > ok

In Extract File name,

DirectMail_<%= formatDate(new Date(), "%4Y-%2M-%2D_%02H-%02N-%02S") %>-000_<%= variables.CampaignId %>_<%= variables.workflowId %>.txt

Once you run the workflow, you will get the expected file name

 

And if you want to add few more variables in file name, you can follow the same step,

In delivery tab,
delivery.variables._var[2].stringValue=<Pass the variable (eg, lastSync)>;

In Property>Variable> Add > Name: lastSync

Extract file name,
DirectMail_<%= formatDate(new Date(), "%4Y-%2M-%2D_%02H-%02N-%02S") %>-000_<%= variables.CampaignId %>_<%= variables.workflowId %>_<%= variables.lastSync %>.txt

 

 

 

 

Translate
~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Soph75Author
Level 2
Nov 11, 2022 11:05 PM UTC

Hi Partha, Thanks for the JS scripts, it's very helpful to achieve the output file script calculation. I've applied the scripts and variables to the recurring delivery but campaignId/deliveryId is not sequential as expected, the output of the two variables need to be incremental values every time I deploy a new campaign (Ex: 3262772_3262771, 3262773_3262772, 3262774_3262773...etc). does it need to be defined somewhere else to achieve the desired output? (See screenshot).

 

 

 

Thanks,

Soph

Translate
ParthaSarathy
Community Advisor
Community Advisor
Nov 12, 2022 9:00 AM UTC

Hi Soph,

Try replacing delivery activity script tab code with below script and re-run the workflow,

var query = xtk.queryDef.create(<queryDef schema="nms:operation" operation="select"><select><node expr="@id"/><node expr="@internalName"/></select><where><condition expr={"@id = '"+instance.operation_id+"'"}/></where></queryDef>); var eventExistss = query.ExecuteQuery(); for each (var eventT in eventExistss.operation){ instance.vars.CampaignId = eventT.@id;}

delivery.variables._var[0].stringValue=instance.id;

delivery.variables._var[1].stringValue=instance.vars.CampaignId;
Translate
~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups