Add days to date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2019 02:31 AM
hi,
In Business Rule How can i add years/days to date .
I have tried like below
var createdDate = new GlideDateTime(attestationGR.sys_created_on);
var duedate = createdDate.addDays(365); //default 1 year
but it throws the below error. Please help me. I cannot use addLocaldays. how to go with adddaysUTC function to align time or another way ?
ERROR : Function addDays is not allowed in scope sn_hr_core. User either addDaysUTC() or addDaysLocalTime() instead
Thanks
JG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2019 02:37 AM
Hi JG,
that is correct addDays() method is not allowed in scoped application; instead use addDaysUTC()
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2019 02:43 AM
My concern is how to convert UTC time to server time,suppose if server is in UK/US ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2024 04:49 AM
Hi Ankur,
I tried by using addDaysUTC() and addDaysLocalTime() in business rule of scoped application but still, it is not giving the value, it says undefined.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2019 02:44 AM
Hi
Try using addDaysLocalTime();
For further clarification please visit this link.
Let me know if it works.
Regards,
Omkar Mone.
www.dxsherpa.com