Expand my Community achievements bar.

SOLVED

Monthly and weekly Email campaign schedule

Avatar

Level 2

Hi team ,

Two email campaigns should be sent every month by 20th and a weekly campaign on Fridays.The campaign should be sent the day prior if the intended date falls on a weekend or holiday.

Thanks,

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @VijayMvj ,

Campaign to Run on every Friday:

Configure the scheduler as per below screenshot,

ParthaSarathy_0-1706011041714.png

Campaign to Run on every 20th of the month and to Run the campaign on Friday if 20th is on Weekend (Sat /Sun) :

Create the Workflow as below,

ParthaSarathy_4-1706011811681.png

 

Scheduler:

Configure the scheduler to Run on every 18th of the month as per below screenshot,

ParthaSarathy_2-1706011518938.png

 

Open Scheduler > Advance tab > Initialization script and paste the below code,

var getDayOf20 = new Date();
getDayOf20.setDate(getDayOf20.getDate() + 2);
getDayOf20 = formatDate(getDayOf20, "%2A");
vars.dayOf20 = getDayOf20;

 

Test Activity:

ParthaSarathy_3-1706011640138.png

//Condition1: (Label: Day of 20 is Saturday)
vars.dayOf20 == 'Sat'

//Condition2: (Label: Day of 20 is Sunday)
vars.dayOf20 == 'Sun'

//Default connection Label as 'Day 20 falls on Weekday'

 

Wait Activity:

Define duration of 1d for Saturday's transition and 2d for weekend transition.

ParthaSarathy_5-1706011941063.png

And connect all 3 transitions to a fork activity (Refer workflow diagram)

 

So, As a result, now when the workflow runs on 18th of a month, it will calculate the day of 20.

If 20 is on Sunday (weekend), the workflow will get executed on 18th itself (Friday - Weekday).

If 20 is on Saturday (weekend), the workflow will wait for 1 day (using wait activity) and get executed on 19th (Friday - Weekday).

If 20 is on any weekday, as the workflow triggers on 18th of a month, it will wait for 2 days (using wait activity) and get executed on 20th.

Hope this logic helps!

View solution in original post

6 Replies

Avatar

Correct answer by
Community Advisor

Hi @VijayMvj ,

Campaign to Run on every Friday:

Configure the scheduler as per below screenshot,

ParthaSarathy_0-1706011041714.png

Campaign to Run on every 20th of the month and to Run the campaign on Friday if 20th is on Weekend (Sat /Sun) :

Create the Workflow as below,

ParthaSarathy_4-1706011811681.png

 

Scheduler:

Configure the scheduler to Run on every 18th of the month as per below screenshot,

ParthaSarathy_2-1706011518938.png

 

Open Scheduler > Advance tab > Initialization script and paste the below code,

var getDayOf20 = new Date();
getDayOf20.setDate(getDayOf20.getDate() + 2);
getDayOf20 = formatDate(getDayOf20, "%2A");
vars.dayOf20 = getDayOf20;

 

Test Activity:

ParthaSarathy_3-1706011640138.png

//Condition1: (Label: Day of 20 is Saturday)
vars.dayOf20 == 'Sat'

//Condition2: (Label: Day of 20 is Sunday)
vars.dayOf20 == 'Sun'

//Default connection Label as 'Day 20 falls on Weekday'

 

Wait Activity:

Define duration of 1d for Saturday's transition and 2d for weekend transition.

ParthaSarathy_5-1706011941063.png

And connect all 3 transitions to a fork activity (Refer workflow diagram)

 

So, As a result, now when the workflow runs on 18th of a month, it will calculate the day of 20.

If 20 is on Sunday (weekend), the workflow will get executed on 18th itself (Friday - Weekday).

If 20 is on Saturday (weekend), the workflow will wait for 1 day (using wait activity) and get executed on 19th (Friday - Weekday).

If 20 is on any weekday, as the workflow triggers on 18th of a month, it will wait for 2 days (using wait activity) and get executed on 20th.

Hope this logic helps!

Avatar

Level 2

Thanks for your response @ParthaSarathy ! and the above explanation was very helpful for weekend condition but I need also if Month of 20th falls on holiday(like Friday)then the campaign has to be sent on Thursday. 

 

Thanks!

Avatar

Level 2

Hi @ParthaSarathy , One more doubt - in this workflow, Instead of wait activity  can we handle it in Query using functions? 

Avatar

Community Advisor

@VijayMvj , In this approach as the scheduler triggers only once a month and it have to check the days and dates, it have to wait for triggering using wait activity.