Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

unable to format 07/24/2020 error in Tranform map

OluseyiS3924078
Tera Contributor

I have two date fields that i am mapping in my Tranform map

 

the source date field has the following format - mm/dd/yyyy <time>  there is no existing date format in ServiceNow that matches that.  Also i need it the instance format - yyyy-mm-dd<time>

 

Is there a way for me to change the format using a script, or will i have to do some manipulation in Notepad++?

6 REPLIES 6

Tanushree Maiti
Tera Sage

Update the source script of field map to:

 

answer = (function transformEntry(source) {

	var targetDate = (source.u_date.getDisplayValue());
	formattedTargetDate = targetRefreshDate.getByFormat("yyyy-mm-dd");
	gs.log("SNOW formatted date - " + formattedRefreshDate);
	return formattedRefreshDate; 

})(source);

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Santhana Rajhan
Mega Sage

Aren't you able to define the date format or create a new one?

TM Date Time format.png