Hello in an adobe campaign classic workflow I am using a "Test" node (the yellow diamond) to check that another workflow "TECHNICALWORKFLOW" has run today before proceeding. This is working well currently with the following script:
formatDate(getOption("lastRunDate_TECHNICALWORKFLOW"),'%2D-%2M-%4Y') == formatDate(getCurrentDate(),'%2D-%2M-%4Y')
I would like to make it so that the test instead, looks to check the TECHNICALWORKFLOW has run any time in the past 3 days, rather than today. I think I need to add +3 days somewhere to the second half of the script, but cannot work it out.
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Add the below script in the Test activity advanced tab.
var date = getCurrentDate();
date.setDate(date.getDate()-3);
vars.currminus3Date = formatDate(date,'%2D-%2M-%4Y');
After that use the below condition in the test activity
formatDate(getOption("lastRunDate_TECHNICALWORKFLOW"),'%2D-%2M-%4Y') >= vars.currminus3Date
Attaching the screenshot also. Hope this helps.
Hi,
Add the below script in the Test activity advanced tab.
var date = getCurrentDate();
date.setDate(date.getDate()-3);
vars.currminus3Date = formatDate(date,'%2D-%2M-%4Y');
After that use the below condition in the test activity
formatDate(getOption("lastRunDate_TECHNICALWORKFLOW"),'%2D-%2M-%4Y') >= vars.currminus3Date
Attaching the screenshot also. Hope this helps.
Views
Replies
Total Likes
Hi @drewettj - an easy way to do this is to subtract the last run time from the current time and see if its less than 3 days. e.g.
(getCurrentDate().getTime() - getOption("lastRunDate_TECHNICALWORKFLOW").getTime())<=259200000
Date.getTime() returns milliseconds for for 3 days = (3 * 1000 * 60 * 60 * 24) = 259200000 milliseconds
Cheers
darren
Views
Replies
Total Likes