Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to format date using format string MM-dd-yyy

Tony28
Giga Contributor

I am currently trying to set up a data import from an SQL database, and I am running into transform errors relating to the date field when attempting to transform the data to the table. Each row has the same error, so here is one example:

Unable to format 08/01/2019 using format string MM-dd-yyyy for field date

I don't understand why this is happening, as when I look at the data being brought in on the import set table, the date field looks just fine. I had a similar problem on another import, but changing the date format didn't help like it did with that one. Any thoughts?

1 REPLY 1

Community Alums
Not applicable

remove that field from mapped fields and add below in the script of the transform map

var sdate = new GlideDateTime(source.your field here); //your field here will be from SQL DB

target.your field here = sdate.getDisplayValue(); //your field here will be field in ServiceNow table