Adding three business days to due date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020 09:01 AM
Hi Everyone,
We have opened date and start date fields on the Requested item form. I want to add three working business days to opened date and need to update that result in the start date. For example I was opened a requested item on 12/6/2020, now start date would be updated as 16/6/2020 (Since 13 & 14th dates are Saturday and Sunday, we need to exclude them). Please help me how to do this. Thank you in advance
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020 09:09 AM
Hello Gowtham,
Create a before update/insert BR and add the below code.
var created = new GlideDateTime(current.sys_created_on);
var sch = new GlideSchedule("090eecae0a0a0b260077e1dfa71da828"); //use your scheudle sysid here
while(!sch.isInSchedule(created)) {
created.addDays(1);
}
gs.print("Next Business day is"+created);
current.start_date=created;
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020 09:22 AM
Hi Asif, Thank you so much for the quick response.
Where i need to create schedule ? in cmn_schedule table ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020 10:44 AM
yes. In the navigation, schedules->schedules
Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.
Regards,
Asif
2020 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2020 09:25 AM
Hi Goutham,
You have to write an before insert BR on the sc_req_item table and the following script will be helpful.
var days = 3;
var creat= new GlideDateTime(current.sys_created_on); // created date
var dur = new GlideDuration(60 * 60 * 24 * 1000 * days); //calculate duration of three days
var schedule = new GlideSchedule('08fcd0830a0a0b2600079f56b1adb9ae'); // Use the Existing 8-5 weekday scheues.
var updatedays = schedule.add(creat, dur);
current.start_date = updatedays;
The schedules you can use here is OOB 8-5 weekdays schedules which includes only business days.
Please mark correct and helpful.
Thanks,
CB