Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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
Kilo Patron

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