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!
SOLVED

To declare variable and to check in test activity

Avatar

Level 1

Hi Team ,

 

In my Javascript activity, I've built an event variable that is set to run every day. When it does, it must first determine whether the current date falls between the start and end dates of the variable, and if it does, it must send an email. Can anyone please help me out of this ?javascript variable.pngScreenshot .png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @sarjoon ,

You can modify the below script,

ParthaSarathy_0-1710828645157.png

 

JavaScript Code activity:

vars.startDate = '01/20/2024';
vars.endDate = '05/22/2024';
vars.currentDate=formatDate(getCurrentDate(), '%2M/%2D/%4Y');

if(vars.startDate < vars.currentDate && vars.currentDate < vars.endDate)
{
vars.eligible = "yes";
}
else{
vars.eligible = "no";
}

 

Test Activity:

vars.eligible == "yes"

ParthaSarathy_1-1710828759085.png

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @sarjoon ,

You can modify the below script,

ParthaSarathy_0-1710828645157.png

 

JavaScript Code activity:

vars.startDate = '01/20/2024';
vars.endDate = '05/22/2024';
vars.currentDate=formatDate(getCurrentDate(), '%2M/%2D/%4Y');

if(vars.startDate < vars.currentDate && vars.currentDate < vars.endDate)
{
vars.eligible = "yes";
}
else{
vars.eligible = "no";
}

 

Test Activity:

vars.eligible == "yes"

ParthaSarathy_1-1710828759085.png