Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Winner needs to be defined from only 2 deliveries in a workflow containing multiple deliveries

Rishabh46
Level 2
Level 2

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.

1 Accepted Solution
wodnicki
Correct answer by
Community Advisor
Community Advisor

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).

View solution in original post

3 Replies
wodnicki
Community Advisor
Community Advisor

Could you post the JS you want to change?

Rishabh46
Level 2
Level 2

// 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

wodnicki
Correct answer by
Community Advisor
Community Advisor

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).

View solution in original post