- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 01:46 AM - edited 02-27-2023 03:23 AM
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 .
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 04:17 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 03:33 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 03:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 03:47 AM
@Naga Ravindra R im even getting this error
Error: "grStrDateTime" is not defined.,Detail: "grStrDateTime" is not defined.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 04:17 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2023 05:03 AM
it worked thank you soo muchh