Due Date on RITM to match a Variable Date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 09:52 AM
I have a requirement to set the Due Date to a specific variable entered date. I did that using the following script:
if(current.variables.projected_start_date)
{
current.due_date = current.variables.projected_start_date;
}
But when testing, it is display the date to a day before instead of the entered date, For example the entered date is 10/01/23 and it sets the due date to 9/30/23. How do I fix this? Thank you in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 10:10 AM
Hello @Moe13
Instead of business rule you can set due date through workflow run script.
Run script:
current.due_date = current.variables.projected_start_date;
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 12:13 PM - edited ‎09-05-2023 01:09 PM
How would I complete the Workflow run script. if this is limited to a specific category? I'm an admin with little scripting knowledge. This due date is only to update on a specific request item and not all. Is there another way this can be fixed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 09:46 PM
Hello Moe13
Workflow will run specific to catalog item.
Please find below Screenshot for reference:
1. Use Run script activity in Workflow
2. Write below Script inside Run script activity
var dueDate = current.variables.date; // you can change variable name as per your item
var dateObj = new GlideDateTime(dueDate);
current.due_date = dateObj;
Output :
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2023 10:58 PM
Could be a timezone issue?
October 1 in requester's timezone could be Sept 30 in System Timezone. Try impersonating the requester or set your timezone to the requester's timezone and check if the due date changed or reflected. If so, that is a TimeZone issue which is fine.