Transform map to update only empty fields

NirupamH1
Tera Contributor

Hi,

 

Consider "Short description" field of incident. I want to run transform map with a coalesce turned on for "Number" Field. There's one additional requirement though, my transform map should update the short description field for an incident record where it is empty and  not for a record which already has a short description. Can someone please help me with this?

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

you can write script in the field map for short description,

you can just write below script:

 

if(target.short_description != ''){

ignore = true;

}

else return source.short_description;

Best Regards
Aman Kumar

View solution in original post

5 REPLIES 5

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can check the target record with the help of number that map is getting from source, if short description is filled ignore = true in the transform script.





Thanks and Regards,

Saurabh Gupta

No I think you misunderstood my requirement. For example, if for INC0001 "security" is short description and I want to update it to "Device", it shouldn't happen but if for another record INC0002 short description is empty, then it should be updated to whatever value I am sending through excel. I hope the requirement is clear now.

Aman Kumar S
Kilo Patron

you can write script in the field map for short description,

you can just write below script:

 

if(target.short_description != ''){

ignore = true;

}

else return source.short_description;

Best Regards
Aman Kumar

Hi @Aman Kumar S , your solution was helpful,

I just modified it a bit. So what I did was for short_description field mapping I used this source script,

 

answer = (function transformEntry(source) {
    if (target.short_description != '') {
    answer = target.short_description;
} else {
    answer = source.short_description;
}
 
return answer; // return the value to be put into the target field
 
})(source);
 
It is working as expected. Thank you.