Expand my Community achievements bar.

Announcing the launch of new sub-community for Campaign Web UI to cater specifically to the needs of Campaign Web UI users!

Passing deliveries dynamically from script to continuous delivery

Avatar

Level 2

I am using the Javascript activity with below script and in the subsequent continuous delivery activity I am setting the activity.scenario_id with delivery created in this script and for recipients in continuous delivery, I am checking the option "specified by the inbound events". But the real issue is the delivery is being created and it's in being edited state, not getting executed can you please help me out on this issue.

test.PNG

Javascript activity code:

  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 @internalName in ('DTB100919070906','DTA100919070906')"}/>

       </where>

       <orderBy>

         <node expr="[indicators/@estimatedRecipientOpenRatio]" sortDesc="true"/>

         <node expr="[indicators/@recipientClickRatio]" 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;

   logInfo(delivery.label);

   // 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"];

   delivery.workflow_id = winner.@["workflow-id"];

   delivery.internalName = "DMF" + formatDate(new Date(), "%2D%2M%2Y%2H%2m%2s");

   // 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 = "auto"; 

   delivery.validation.useBudgetValidation =false; 

   delivery.validation.useContentValidation = false; 

   delivery.validation.useExtractionValidation = false; 

   delivery.validation.useTargetValidation = false; 

   delivery.validation.useFCPValidation = false;

   delivery.scheduling.delayed = 0;

   // save the delivery in database

   delivery.save();

   vars.deliveryId = delivery.id;

Continuous delivery activity script:

activity.scenario_id = vars.deliveryId;

vars.recipientsL

5 Replies

Avatar

Level 4

Hi shivakumar,

activity.scenario_id should be loaded with delivery template id, not the actual delivery id. Since you cloning already executed delivery, it seems that you are attempting to load your scenario with actual delivery id.

I would suggest to find the template id of finished delivery and use its value.

What does your delivery logs say?

Avatar

Level 2

Thanks for response, yea realized this after posting, but my query is the created delivery never executed and why the continuous delivery isn't throwing any error if it expects template id.

Avatar

Level 4

Yes, that is probably an error in Adobe.

However, if you think how this component might work, it actually makes sense. As I have mentioned before, continuous delivery will check first if delivery has been cloned already. Deliveries and the delivery templates are, in fact, same entities: nms:delivery. The difference is in @isModel attribute. The template will have it set to 1.

Since you already have fed the activity with actual delivery, the activity will find out, that delivery has been already created, will add new recipients to it and finish. And since delivery hasn't been actually started, it will continue to exist in edit state.

If you will check the delivery logs, you will probably see it had new recipients added to it.

If you use GUI, you will not be able to load activity with actual delivery, it will filter on @isModel attribute. But, since you do it manually through a javascript, there will be no checks.

Avatar

Level 10

Hi Dima,

Please submit a ticket so we can take a look.

Thanks!

Avatar

Level 4

Also, I have quickly checked the A/B example from Adobe ( A/B testing )

The reason, they use this code, is because they do not use continuous delivery to send winning delivery to the customers. They use simple delivery activity.

Continuous Delivery works a bit differently. It accepts a delivery template. When it runs, it checks, have this template been cloned since last time it has been edited. If it hasn't been, the activity will clone the template into delivery and will execute it. If delivery has been cloned and the template hasn't been changed after that, the activity will add new recipients to an existing delivery.

Please remember, you cannot execute the delivery template, it has to be cloned into delivery first. And you cannot clone delivery into the delivery template.