- 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 01:47 AM
try this
var updatedTime = new GlideDateTime(gr.sys_updated_on);
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:54 AM
Hi @Sathwik1
This might be because when you do 'gr.update()' , 'sys_updated_on' will get updated again with current date and time Or as Ankur suggested may be different timezone issue.
If possible ,Can you let us know what you are trying to do here...
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
‎02-17-2025 01:25 AM
How to fix timezone issue?