Update target with a null value if the source is null from transform map

Community Alums
Not applicable

Update target with a null value if the source is null from transform map with out using 'Copy Empty Fields'

 

I have used below script but it is not working, could I get some help here please

answer = (function transformEntry(source,target) {

//var gdt = new GlideDateTime(source.u_last_day);
//return gdt.getValue();
//if (source.u_last_day == '') {
if (source.u_last_day.nil()){
target.u_last_day == '';
}

})(source);

22 REPLIES 22

@Community Alums 

try this

target.setValue('u_last_day','');

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

Community Alums
Not applicable

Sorry, this didn't work too

@Community Alums 

did you check by clearing some other field?

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

Community Alums
Not applicable

Yes,  the script is working for other string fields. Not working only on date fields.

Can you check if that field is mandatory on table level? Any import logs you found? Maybe there's data policy or something.