Expand my Community achievements bar.

SOLVED

Ab test workflow to test 4 subject lines in one workflow

Avatar

Level 4

@Parvesh_Parmar ,@AkshayAnand 

,@isahore ,@AndreaBriceno,@ParthaSarathy

,@ParthaS ,@Craig_Thonis ,@Manoj_Kumar_ ,@Amine_Abedour ,@Marcel_Szimonisz,@DavidKangni 

,@Amit_Kumar,@ShashankNigam02,@Ganesh5067, @Jonathon_wodnicki

@Amine_Abedour 

 

hi all

i need to create ab test workflow to test 4subject lines in one workflow

 

also when i am runnjng out of box script given in

aodbe doc

its failing ..any one have ab test Js script code 

which support 4segment in a wkf

also please share insights what and how can we modify the oob script to make this work for 4segments

 

 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @DishaSharma,

 

Can you share details as to what error you are seeing and what code have you written?

The standard js code that evaluates the winner delivery based on the configured criteria should work fine for handling any number of variants.

 

 // query the database to find the winner (here - best click rate)
   var winner = xtk.queryDef.create(
     <queryDef schema="nms:delivery" operation="get">
       <select>
         <node expr="@id"/>
         <node expr="@label"/>
         <node expr="[@operation-id]"/>
         <node expr="[@workflow-id]"/>
       </select>
       <where>
         <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
       </where>
       <orderBy>
         <node expr="[indicators/@totalRecipientClickRatio]" 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)

   // 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.
   delivery.operation_id = winner.@["operation-id"]
   delivery.workflow_id = winner.@["workflow-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

BR,

Ishan

 

BR,

Ishan

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @DishaSharma,

 

Can you share details as to what error you are seeing and what code have you written?

The standard js code that evaluates the winner delivery based on the configured criteria should work fine for handling any number of variants.

 

 // query the database to find the winner (here - best click rate)
   var winner = xtk.queryDef.create(
     <queryDef schema="nms:delivery" operation="get">
       <select>
         <node expr="@id"/>
         <node expr="@label"/>
         <node expr="[@operation-id]"/>
         <node expr="[@workflow-id]"/>
       </select>
       <where>
         <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id}/>
       </where>
       <orderBy>
         <node expr="[indicators/@totalRecipientClickRatio]" 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)

   // 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.
   delivery.operation_id = winner.@["operation-id"]
   delivery.workflow_id = winner.@["workflow-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

BR,

Ishan

 

BR,

Ishan