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

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

Avatar

Avatar
Validate 1
Level 2
Rishabh46
Level 2

Likes

5 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Rishabh46
Level 2

Likes

5 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Rishabh46
Level 2

05-02-2019

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.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

07-02-2019

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

Answers (2)

Answers (2)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

06-02-2019

Could you post the JS you want to change?

Avatar

Avatar
Validate 1
Level 2
Rishabh46
Level 2

Likes

5 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 1
Level 2
Rishabh46
Level 2

Likes

5 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
View profile
Rishabh46
Level 2

07-02-2019

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