Unable to format 14/08/2021 00:170 using format string yyyy-MM-dd HH:mm:ss for field start_date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2021 03:41 AM
Hi All,
I am getting error while importing change records using transform map. Please suggest?
com.glide.db.impex.transformer.TransformCoercionException: Unable to format 14/08/2021 00:170 using format string yyyy-MM-dd HH:mm:ss for field start_date
Thanks
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2021 05:04 AM
16/06/2021 14:26
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2021 05:23 AM
Hi,
then you can do this in onBefore transform script
Script:
var incomingValue = '16/06/2021 14:26';
incomingValue = incomingValue + ':00'; // add seconds
var format = 'dd/MM/yyyy HH:mm:ss';
var gdt = new GlideDateTime();
gdt.setDisplayValue(incomingValue, format);
gs.info(gdt);
Output:
Transform Map onBefore script:
var incomingValue = source.u_field;
incomingValue = incomingValue + ':00'; // add seconds
var format = 'dd/MM/yyyy HH:mm:ss';
var gdt = new GlideDateTime();
gdt.setDisplayValue(incomingValue, format);
target.start_date = gdt;
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
08-24-2023 02:58 AM
Hi,
Go to your transform map which you have created and in the source_field_name field mapping there is field called "Date Format". Edit this filed with appropriate format your looking for.
Example :
If the format is like this : 17/06/1992 10:20:45 then add below format in 'Date Format'.
i.e. dd/MM/yyyy HH:mm:ss
Regards
Manish