Hi,
I have a workflow that contains multiple email deliveries and I wish to generate a winner email from only 2 deliveries in that workflow.
What change do I need to make in the JS for achieving the same.
Thanks in Advance.
Solved! Go to Solution.
Thanks. Change this line:
<condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
To:
<condition expr={"@internalName in ('deliveryName1', 'deliveryName2')"}/>
Where deliveryName1, 2 are the internal names of the deliveries (Properties > Internal name).
Could you post the JS you want to change?
// query the database to find the winner (best open rate)
var winner = xtk.queryDef.create(
<queryDef schema="nms:delivery" operation="get">
<select>
<node expr="@id"/>
<node expr="@label"/>
<node expr="[@operation-id]"/>
</select>
<where>
<condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
</where>
<orderBy>
<node expr="[indicators/@estimatedRecipientOpenRatio]" sortDesc="true"/>
</orderBy>
</queryDef>).ExecuteQuery()
// create a new delivery object and initialize it by doing a copy of
// the winner delivery
var delivery = nms.delivery.create()
delivery.Duplicate("nms:delivery|" + winner.@id)
logInfo("Winner: " + winner.@id)
// append 'final' to the delivery label
delivery.label = winner.@label + " Final"
//link the delivery to the operation to make sure it will be displayed in
// the campaign dashboard. This attribute needs to be set manually here since
// the Duplicate() method has reset it to its default value => 0
delivery.operation_id = winner.@["operation-id"]
// adjust some delivery parameters to make it compatible with the
// "Prepare and start" option selected in the Delivery tab of this activity
delivery.scheduling.validationMode = "manual"
delivery.scheduling.delayed = 0
// save the delivery in database
delivery.save()
// store the new delivery Id in event variables
vars.deliveryId = delivery.id
Views
Replies
Total Likes
Thanks. Change this line:
<condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
To:
<condition expr={"@internalName in ('deliveryName1', 'deliveryName2')"}/>
Where deliveryName1, 2 are the internal names of the deliveries (Properties > Internal name).
Views
Likes
Replies