Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Unable to format 14/08/2021 00:170 using format string yyyy-MM-dd HH:mm:ss for field start_date

Tara16
Giga Contributor

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

 

 

7 REPLIES 7

16/06/2021 14:26

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:

find_real_file.png

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

mansa12
Tera Contributor

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