- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2019 09:13 AM
Hi,
This is a scenario of my request.
Incident table has a field Opened - which is date time field. I have to create a new field on Incident table my_Opened and its should be date field and I have to create a fix script to copy only the date values for all records from "opened" to "my_Opened" field.
1. To create a new column, I did through configure dictionary, is that correct?
2. I have written the below fix script but the dates are increasing by 1-
var gr = new GlideRecord('incident');
gr.query();
while(gr.next()){
gr.u_my_opened = gr.opened_at;
gr.setWorkflow(false);
gr.update();
The dates in my_opened are increasing by 1, screenshot attached.
Can someone please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2019 06:31 AM
Can you try
gr.setValue('u_my_opened', gr.getDisplayValue('opened_at'));
Vinod Kumar Kachineni
Community Rising Star 2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2019 09:16 AM
Hi there,
This is not occurring for all dates I see. How about your timezone setting on your system? Is their a difference in that?
I think the time difference is the issue. Let me test.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2019 09:25 AM
Aaaahhhh I take it back... just tested your exact code on my PDI: No issues.
If you compare one of the wrong records on XML level, how do the dates look like then?
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2019 11:42 AM
Hi Mark,
Thanks, it worked by using getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2019 09:32 AM
try
gr.u_my_opened = gr.opened_at.getValue();
Vinod Kumar Kachineni
Community Rising Star 2022