To declare variable and to check in test activity | Community
Skip to main content
March 19, 2024
Solved

To declare variable and to check in test activity

  • March 19, 2024
  • 1 reply
  • 661 views

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 ?

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 ParthaSarathy

Hi @sarjoon ,

You can modify the below script,

 

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"

1 reply

ParthaSarathy
Community Advisor
ParthaSarathyCommunity AdvisorAccepted solution
Community Advisor
March 19, 2024

Hi @sarjoon ,

You can modify the below script,

 

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 S~  Click here to join ADOBE CAMPAIGN USER GROUP for Quarterly In-person | Hybrid | Virtual Meetups