- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 07:37 PM - edited 08-03-2023 07:43 PM
Hi all,
I am facing a issue while importing the Date/Time field from Source instance.
Source Instance (display_value) -
Record 1 - 02-08-2023 10:46:14
Record 2 - 13-12-2022 19:45:06
Target Instance :
Record 1 - 2023-02-08 10:46:14
Record 2 - 2022-12-13 19:45:06 (Expected format)
Even the Source field format is same for both the records still value is reflecting differently in Same Field.
Value imported using display_value method:
The data should be imported in 2nd Record Format.
Please let know the possible way to resolve this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 10:36 PM
something like this. I assume the source value always has this format dd-MM-yyyy HH:mm:ss
var dateTime = parsedData.result[i].sys_updated_on.display_value;
var gdt = new GlideDateTime();
var simpleDateFormat = 'dd-MM-yyyy HH:mm:ss';
gdt.setDisplayValue(dateTime, simpleDateFormat);
gr.setValue('u_source_updated_on',gdt.getValue());
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
08-03-2023 08:24 PM
Hi,
Can you please share what configurations you have done at Transform map field mapping?
What is the Date format in your Payload (I hope it is fixed).
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 09:37 PM
Hi @Anil Lande
Payload showing this values, which I mentioned below
Source Instance (display_value) -
Record 1 - 02-08-2023 10:46:14
and the code is written in schedule job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 09:47 PM
you need to convert the source value to the format of YYYY-MM-dd HH:mm:ss
OR
can you try with just this? don't use display_value from json
gr.u_source_updated_on = parsedData.result[i].sys_updated_on;
Could you also share the json body how it looks like?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2023 10:16 PM
Hi @Ankur Bawiskar
Could you share the method to convert the date format to YYYY-MM-dd HH:mm:ss, of parsedData.result[i].sys_updated_on;