Create Catalog task after 30 days from the selected date in variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I have to create the Catalog task after 30 days from the selected date in the variable.
for example, If I select today's date in the variable and the catalog task should create after 30 days. (i.e, on July 24th).
var termDate = current.variables.term_date;
if (termDate) {
var targetDateTime = new GlideDateTime(termDate + "00:00:00");
//wait until 30 days after Disable IT Access Date
//targetDateTime.addDaysUTC(1);
targetGDT.addDaysLocalTime(30);
var currentDateTime = new GlideDateTime();
var diffSeconds = Math.floor((targetDateTime.getNumericValue() - currentDateTime.getNumericValue()) / 1000);
answer = diffSeconds > 0 ? diffSeconds : 0;
} else {
answer = 0;
}I have created Timer activity and the Timer based on Script, Can you please check and suggest.
And also, please suggest how to test it.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I would not recommend having a 30 day wait condition within the flow. I think a scheduled job that runs every evening should query through the relevant Requested Items and create the task if 30 days has passed. Create a flow variable that is 30 days before the run time and every variable time that is before that time get's a task created. That way you don't have tons of workflow just stuck in a waiting phase.