We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Convert and populate date of String type to the Date type field using field map script(transform map

kamadi lokeshra
Tera Contributor
 
1 REPLY 1

Tanushree Maiti
Giga Sage

Hi @kamadi lokeshra 

 

Here is the script:

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

var dtObj = new GlideDate();
dtObj.setDisplayValue(source.u_actual_date, "dd-MMM-yyyy");
var dtVar = dtObj.getByFormat("MM-dd-yyyy");
target.actual_date= dtVar;

})(source, map, log, target);

 

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