Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

flow designer due date

suprajam
Tera Contributor

I want to set due date in flow designer where i just need to minus 14 days  from current date and return in due date for flow designer .

1 ACCEPTED SOLUTION

var gdtDateTime = new GlideDateTime();

var grSchedule = new GlideRecord('cmn_schedule');
grSchedule.addQuery('sys_id', '377f9850dbe07b803b841ded0b961950');
grSchedule.query();
if (grSchedule.next()) {
var counter = 14;
var grSched = new GlideSchedule(grSchedule.sys_id);
for (i = 0; i < counter;) {
gdtDateTime.addDaysLocalTime(-1);
if (grSched.isInSchedule(gdtDateTime)) { 
i++;
}
}
}

var todayDateEsd = gdtDateTime; 
var gettingDate = todayDateEsd.getDate();  

return gettingDate;

 

Make sure you create a schedule in 'cmn_schedule' table and have a schedule entries .

Refer to the screenshots.

Please mark as correct/helpful if it helps.

View solution in original post

12 REPLIES 12

var gdt = new GlideDateTime(fd_data.trigger.request_item.variables.Action_date);

var gdtDateTime = new GlideDateTime();

var grSchedule = new GlideRecord('cmn_schedule');
grSchedule.addQuery('sys_id', '377f9850dbe07b803b841ded0b961950');
grSchedule.query();
if (grSchedule.next()) {
var counter = 14;
var grSched = new GlideSchedule(grSchedule.sys_id);
for (i = 0; i < counter;) {
grStrDateTime.addDaysLocalTime(-1);
if (grSched.isInSchedule(gdtDateTime)) { 
i++;
}
}
}

var todayDateEsd = gdtDateTime; 
var gettingDate = todayDateEsd.getDate();  

return gettingDate;

 

Make sure you create a schedule in 'cmn_schedule' table and have a schedule entries .

Refer to the screenshots.

Please mark as correct/helpful if it helps.

ill try this but can i know why the first line with action field is there cause im not performing action based on that i gave that line misteake before and can you provide your mail id so that if theres any clarification i ll reach out to you

 

@Naga Ravindra R im even getting this error

 Error: "grStrDateTime" is not defined.,Detail: "grStrDateTime" is not defined.

var gdtDateTime = new GlideDateTime();

var grSchedule = new GlideRecord('cmn_schedule');
grSchedule.addQuery('sys_id', '377f9850dbe07b803b841ded0b961950');
grSchedule.query();
if (grSchedule.next()) {
var counter = 14;
var grSched = new GlideSchedule(grSchedule.sys_id);
for (i = 0; i < counter;) {
gdtDateTime.addDaysLocalTime(-1);
if (grSched.isInSchedule(gdtDateTime)) { 
i++;
}
}
}

var todayDateEsd = gdtDateTime; 
var gettingDate = todayDateEsd.getDate();  

return gettingDate;

 

Make sure you create a schedule in 'cmn_schedule' table and have a schedule entries .

Refer to the screenshots.

Please mark as correct/helpful if it helps.

it worked thank you soo muchh