- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 10:25 PM
hi all,
In my change request, i want to have my planned end auto populate based on start date with 5 days added. how can i do this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 10:29 PM
Hello Priti,
If you want business days to add, then use schedules. Refer to this article where i have shown how to add business days.
If you just wnat to add 5 days then in teh business rule
Before update
var startDate = new GlideDateTime(current.planned_start); //check field names
startDate.addDays(5);
current.planned_end=startDate;
Mark the comment as a correct answer and helpful if this helps to solve the problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 10:29 PM
Hello Priti,
If you want business days to add, then use schedules. Refer to this article where i have shown how to add business days.
If you just wnat to add 5 days then in teh business rule
Before update
var startDate = new GlideDateTime(current.planned_start); //check field names
startDate.addDays(5);
current.planned_end=startDate;
Mark the comment as a correct answer and helpful if this helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 10:56 PM
i have to add as per business days .....will check your link and let you know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 11:41 PM
i followed steps in the above link worked for me
thanks asif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2020 10:52 PM
Hi,
you should use before insert/update BR
condition: current.start_date != ''
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gdt = new GlideDateTime(current.start_date);
gdt.addDays(5);
current.end_date = gdt;
})(current, previous);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader