Formula to schedule contact date and time | Community
Skip to main content
Level 6
Sep 23, 2023 4:15 AM UTC
Solved

Formula to schedule contact date and time

We have this formula, it tries to contact Recipients between 8 am and 8 pm,  in this case it is set to 9 am.

I'd like to make it directly, like: send this delivery the next day at 9 am. Or even better that the user the possibility to insert directly the date: 28/09/23 at 9 am. 

Iif( Hour(GetDate())<=8 , AddHours(ToDate(GetDate()),8) , AddHours(AddDays(ToDate(GetDate()),1),9) )

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ParthaSarathy
ParthaSarathyAccepted solution
New Participant
Sep 26, 2023 12:02 PM UTC

Hi @god_prophet ,

Use the below expression in your delivery's scheduling

Iif(Hour(GetDate())<8,AddHours(DateOnly(GetDate()),9 ) ,Iif(Hour(GetDate())>19,AddDays(AddHours(DateOnly(GetDate()),9 ),1 ) ,GetDate() ) )

 

 

The above formula works in a way that,

If the delivery gets triggers at before 8 AM, then the delivery's contact will be set to Same day's 9AM.

If the delivery was triggered after 8 PM, then the delivery's contact will be set to Next day's 9AM.

So your Recipient wont get an email before 8 AM and not after 8 PM.

 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups

4 replies

ParthaSarathy
ParthaSarathyAccepted solution
New Participant
Sep 26, 2023 12:02 PM UTC

Hi @god_prophet ,

Use the below expression in your delivery's scheduling

Iif(Hour(GetDate())<8,AddHours(DateOnly(GetDate()),9 ) ,Iif(Hour(GetDate())>19,AddDays(AddHours(DateOnly(GetDate()),9 ),1 ) ,GetDate() ) )

 

 

The above formula works in a way that,

If the delivery gets triggers at before 8 AM, then the delivery's contact will be set to Same day's 9AM.

If the delivery was triggered after 8 PM, then the delivery's contact will be set to Next day's 9AM.

So your Recipient wont get an email before 8 AM and not after 8 PM.

Translate
 ~  ParthaSarathy S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups
Amine_Abedour
New Participant
Sep 24, 2023 9:10 AM UTC

Hello @god_prophet 

 

You can use the bellow code (after tunning it to your use case) to set a different contactDate of a delivery.

The code should be in the ''script'' tab of delivery activity: 

 

//get the current date and time var contactDate = new Date(); //set contactDate to current date and time + 24h contactDate.setDate(contactDate.getDate()+1); // tell the current delivery that the routing should be delayed delivery.scheduling.delayed = true; // set contactDate of current delivery to the date in the variable contactDate delivery.scheduling.contactDate = contactDate;

 

 

Br,

Amine

Translate
Amine ABEDOUR
Marcel_Szimonisz
New Participant
Sep 23, 2023 7:49 AM UTC

Hello @god_prophet ,

hello is this automated campaign? with continuous delivery? and you want to only deliver messages between 9am 9pm? Or what is that you want? You want trigger campaign from control workflow? 

 

Marcel Szimonisz

MarTech Consultant
for more tips visit my blog
https://www.martechnotes.com/

Translate
Level 6
Sep 23, 2023 10:40 AM UTC

So this is a manual Campaign, it was a Start activity, not a Scheduler activity. So the idea is that user should be able to start the Campaign at anytime, run the queries and so on, but the delivery should arrive to user only between 8 am and 8 pm.

So instead of: 

Iif( Hour(GetDate())<=8 , AddHours(ToDate(GetDate()),8) , AddHours(AddDays(ToDate(GetDate()),1),9) )

I was looking for formula, like this pseudocode:

Send delivery the next day at X hour.
Or: Send delivery on "dd-mm-yy" at X hour.

Company use Recurring delivery, but I guess the should use  just the Email delivery, right?  Not sure about the difference, will have to investigate.

Translate