- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 11:48 AM
I have a Due Date field on my catalog form, named csc_due_date. In the workflow on the Create Task activity, I'm using the due date on the task ticket. I'm using this script:
task.due_date = current.variable_pool.csc_due_date;
The due date field gets updated, but it's off by a day. For example, if I pick 1/15/2022 as my due date on the form, the ticket gets a due date of 1/14/2022.
I don't understand why I'm off by a day. Any help appreciated.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 09:21 PM
Hi,
possibly because of timezone
use this
task.due_date = new GlideDateTime(current.variable_pool.csc_due_date);
Regards
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
‎01-24-2023 06:59 PM
Can you please post a new question and tag me there as this is older thread
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-07-2022 10:43 PM
Hi,
As Ankur said this can be a timezone issue. We also faced this issue a number of times because by default the script takes the system timezone . If you want you can change your timezone also from your profile and check once because we also did the same.
Regards,
Maharshi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 07:37 AM
I'm afraid my mistake was in not noticing the catalog field was a Date field while the Due Date field on the task ticket is a Date/Time field. Once I changed the field type, I was able to use Ankur's code:
task.due_date = new GlideDateTime(current.variable_pool.csc_due_date);
Thanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2022 08:05 PM
Did you mistakenly marked your own response as correct?
Would you mind marking my response as correct if I was able to help you.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader