- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2025 12:22 AM
I want to copy and paste "updated on" value to "latest" value by using the below script, Date is updating fine, but time is not updating correctly. what is the issue here?
var gr = new GlideRecord('incident');
gr.addQuery('sys_id','7b8ead8a9363d6105b0f336efaba104b');
gr.query();
if(gr.next())
{
gr.latest_date = new GlideDateTime(gr.sys_updated_on);
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2025 01:10 AM
that's what I said, set the value in GMT in the new field
did you use this line? and then see in XML if both the values are same
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
‎02-17-2025 12:25 AM
this line will set the value in GMT. you can verify by checking show XML of the record
the value shown on form or list is as per your timezone
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
‎02-17-2025 01:06 AM
How to fix this issue? I need same time too..
Expected : 2024-07-17 08:15:55
What was updated (based on the above script) : 2024-07-17 13:45:55
Those records might be created by different persons in different timezones.. but now here, I need exact time too.. anything can you suggest? @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2025 01:10 AM
that's what I said, set the value in GMT in the new field
did you use this line? and then see in XML if both the values are same
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
‎02-17-2025 01:24 AM
Yes, I used the below line..