- 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 10:16 AM
Hi,
What does individual value mean?
2020-03-02T09:29:13.311-08:00
Blue -> date
Orange -> Time
What does the last part mean?
The incoming value doesn't look like a valid ISO8601-date format which is yyyy-MM-ddTHH:mm:ssZ
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:24 AM
Yes Blue is Date, Orange is Time, the Rest i believe is i want to say milisecond and Time zone, which is useless to me, so that is why im using slice

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 10:26 AM
Did you try using,
var evd = a.replace(/T/g, '');
instead of
var evd = a.replace("T", '');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 10:30 AM
Yes, this works, The field on the table is in the correct format however the error message is still on the transform

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2020 10:33 AM
So, just to confirm this was tried for all 3 & not just var evd?
Also, the error message that appears is
Unable to format 2020-03-02T00:00:00 using format string yyyy-MM-dd hh:mm:ss for field u_effective_date
which still has T in it. Which should not be the case after replace.
Are you sure you tried it for all values & not just evd from your script.