- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:46 AM
Hi All,
As the title states, on my import set table i have 3 string fields that are filled with a date, time, and timezone. The format looks like this and ServiceNow does not like the format, the import errors out,
var a = source.u_event_date.slice(0, 19);
var b = source.u_create_date.slice(0, 19);
var c = source.u_effective_date.slice(0, 19);
var evd = a.replace("T", "");
var efd = b.replace("T", "");
var cd = c.replace("T", "");
target.u_event_date = evd;
target.u_effective_date = efd;
target.u_create_date = cd;
})(source, map, log, target);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:50 AM
Can you try using replace in below format,
var evd = a.replace(/T/g, '');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 09:50 AM
Can you try using replace in below format,
var evd = a.replace(/T/g, '');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 11:11 AM
I ended up writing a script and using var evd = a.replace(/T/g, ''); on the source field directly.
No errors present when importing data. Field Values update as they should,
thanks for all your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 10:05 AM
Hi,
So you have 3 incoming values in format as -> 2020-03-02T09:29:13.311-08:00 that needs to be mapped into 3 fields
All 3 target fields are of same type? Are those date type or date/time?
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
05-26-2020 10:14 AM
they are all date/time on the target table