- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 06:31 AM
Hello,
I am looking to add some logic to a Catalog item and am needing to set a Catalog Tasks due date to 5 days prior to a variable date.
On the catalog item, users are populating a "Go Live Date", go_live_date, and after submission I would like a catalog task to get a due date of 5 business days prior to the date the end user submitted.
I am having issues with getting this to work and would appreciate some help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 07:27 AM
then in the catalog task activity use Advanced script and use this
var dt = new GlideDateTime(current.variables.go_live_date); // give correct variable name here
dt.addDaysUTC(-5);
task.setValue('due_date',dt.getValue()); // give correct field name here
Something like this
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 07:59 AM
Hi Ankur!
This worked thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 10:03 AM
@Ankur Bawiskar actually one follow up. It looks like it is doing total days, how can I have this script exclude weekends?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2024 08:22 PM
you can use scripting and exclude weekends
How to add 5 days to a date excluding weekends
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader