The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Transform map returns undefined value in the field

Miloslav1
Tera Contributor

Hello, I was trying to understand what I might did wrong here.

My goal here is to change only value from "###" to "aaa", the rest of the values should remain untouched.

Unfortunately with this easy function script I am able to change the value "###" to "aaa", but the rest of the fields changed its value to "undefined". Can you please let me know what I am missing here? Thanks in advance.

 

Here is the simple transform map script function:

answer = (function transformEntry(source) {

if (source.u_business_phone == '###' ){ return 'aaa';}

})(source);

Here is the screen from instance before the transform, then the excel sheet with new data and then after the transform is complete.

1 ACCEPTED SOLUTION

Robbie
Kilo Patron
Kilo Patron

Hi @Miloslav1,

 

Based on the script you've provided, you're running this as a script at field level. (Business phone field)

I've made a small tweak to your script to use:

 

answer = (function transformEntry(source) {
if (source.u_business_phone == '###') {
return 'aaa';
} else {
return source.u_business_phone;
}
})(source);

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

View solution in original post

6 REPLIES 6

@Miloslav1,

 

Happy to help and glad it solved your issue. 

 

Thanks,

Robbie

Saloni Suthar
Mega Sage
Mega Sage

Can you please try below logic in your script?

 

(function runTransformScript(source, map, log, target) {

    if (source.u_business_phone == "###") {
        
        target.u_business_phone = "aaa";
    } else {
      
        target.u_business_phone = source.u_business_phone;
    }
})(source, map, log, target);

 

 

If my response helped you, please mark it as correct or helpful.


If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni