How to schedule a delivery from a script Activity in Campaign Classic | Community
Skip to main content
Level 2
September 2, 2021
Solved

How to schedule a delivery from a script Activity in Campaign Classic

  • September 2, 2021
  • 2 replies
  • 2722 views

Hi,

We have a requirement to schedule a Delivery based on Recipient Timezone. This needs to be achieved programatically, (In a script activity) based on our existing design.
Currently, we have below code snippet which triggers the delivery.

var emailTemplate = "del001" //internal name of Delivery Template
var recipientID = "6784568"
nms.delivery.SubmitNotification(emailTemplate,
<delivery>
<targets>
<deliveryTarget>
<targetPart exclusion='false' ignoreDeleteStatus='false'>
<where>
<condition expr={'@id ='+recipientID}/>
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>);


We have updated the XML Payload as below by adding  </scheduling> and anticipated that it would schedule a delivery. But it didnt work. 

var emailTemplate = "del001" //internal name of Delivery Template
var recipientID = "6784568"
nms.delivery.SubmitNotification(emailTemplate,
<delivery>
<scheduling contactDateTimeZone="Europe/London" contactDate="2021-09-02 05:05:00.000Z" delayed="1" extraction="2021-09-02 05:00:00.000Z" validationMode="auto" validityDate="2021-09-07 05:05:00.000Z" webResPurged="false">
<waves mode="0" splitDelay="86400" splitSize="20%"/>
<messagePreparation _login="" forecasted="0" priority="0"/>
</scheduling>
<targets>
<deliveryTarget>
<targetPart exclusion='false' ignoreDeleteStatus='false'>
<where>
<condition expr={'@id ='+recipientID}/>
</where>
</targetPart>
</deliveryTarget>
</targets>
</delivery>)


Let us know what would be key attributes on Delivery & Scheduling to make it perfect and how we can acheive this in Adobe Campaign Classic.

TIA!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Malarrajan_Sundar

Hi @mrudulm9146324 ,

The timezone for "Asia/Calcutta" is (GMT+05:30). Refer xtk:common:timezone

You can check the delivery schedluing section.

For Example:

 

- Malarrajan Sundarraj

 

2 replies

Marcel_Szimonisz
Community Advisor
Community Advisor
September 3, 2021

Hello @mrudulm9146324,

execute delivery and see the scheduling.
I have something like

<scheduling IPAffinity="default" contactDate="2021-08-05 12:26:37.169Z" contactDateTimeZone="Europe/Zurich"
              delayExtraction="0" delayed="0" expectedBudget="" expectedContent=""
              expectedEdition="" expectedExternal="" expectedExtraction="" expectedFCP=""
              expectedForecast="" expectedTarget="" extracted="" extraction="" reminderBudget=""
              reminderContent="" reminderEdition="" reminderExternal="" reminderExtraction=""
              reminderFCP="" reminderForecast="" reminderTarget="" validationMode="manual"
              validityDate="2021-08-10 12:26:37.169Z" webResPurged="0" webValidityDate="2021-10-04 12:26:37.169Z">

I can see some of the attributes you are missing in yours but no idea if that will do the trick 🙂


Have you tried to do it inside workflow with split by time zone and compute the wait time  according to the time zone?


Or even split all the time zones to separate workflows?


Also I assume you send this not only for one recipient but in bulk right?

 

Marcel

Level 2
September 3, 2021

Thanks for the Response, Marcel.
Yes i have tried with above mentioned Attributes and no luck & yes, it is a bulk delivery and the each recipient in the list would be from different timezone.

Have you tried to do it inside workflow with split by time zone and compute the wait time  according to the time zone? Or even split all the time zones to separate workflows?

-
Could you please share snippet if you have? As per current design we are preferring to trigger this from the Script.

Adobe Employee
September 6, 2021

Hello @mrudulm9146324 ,

 

Here the code to schedule the delivery using javascript

 

var xmlTargeting = <delivery>

  <targets >

    <deliveryTarget>

      <targetPart exclusion='false' ignoreDeleteStatus='false'>

        <where>

          <condition expr={'@id=' + rId}/> // Recipient ID

        </where>

      </targetPart>

    </deliveryTarget>

  </targets>

</delivery>;

var finalDev = nms.delivery.CreateFromModel(template, xmlTargeting); // Delivery internal name ( Template )

var deliv = nms.delivery.create(finalDev);

deliv.scheduling.delayed=1;

deliv.scheduling.contactDate = formatDate(getOption('TestExecutionDate'), "%4Y-%2M-%2D %2H:%2N:%2S"); //scheduling date 

deliv.scheduling.validationMode = "auto";

deliv.validation.useBudgetValidation = false;

deliv.validation.useContentValidation = false;

deliv.validation.useTargetValidation = false;

deliv.validation.useFCPValidation = false;

deliv.content.sms.source='Hi Welcome';

deliv.operation_id=campId;
 

deliv.save();

nms.delivery.PrepareFromId(deliv.id);

 

- Malarrajan Sundarraj

Level 2
September 7, 2021

Thanks @malarrajan_sundar !
We are able to schedule. Along with contactDate we are also trying to trigger based on TimeZone.
For Ex: If we have contactDate Value as 7th Sept 2021, 6PM it should deliver based on the set Timezone
(If it is IST - it should trigger at 7th Sept 2021, 6PM IST)
But currently it is delivering at GMT 7th Sept 2021, 6PM. 
Below is the snippet. 
Any idea how we can achieve this ?
deliv.scheduling.contactDate = formatDate(getOption('ExecutionTime'), "%4Y-%2M-%2D %2H:%2N:%2S");
deliv.scheduling.contactDateTimeZone="Asia/Calcutta"

Malarrajan_SundarAdobe EmployeeAccepted solution
Adobe Employee
September 8, 2021

Hi @mrudulm9146324 ,

The timezone for "Asia/Calcutta" is (GMT+05:30). Refer xtk:common:timezone

You can check the delivery schedluing section.

For Example:

 

- Malarrajan Sundarraj