Coalease field script is not working to remove undefined values

Vamshi_ch123
Tera Contributor

Hi All,

 

I have unique identifier field marked as coalease and now filtering some undefined values from this using below script  is giving me the error message like this "Unable to resolve target record, coalesce values not present: [Script]"

(function transformEntry(source) {
    if (!source.u_serial_number || source.u_serial_number.toString() === "Undefined") {
        ignore = true;
    } else {
        return source.u_serial_number;
    }
})(source);
 
How to fix this
thank you
2 REPLIES 2

AshishKM
Kilo Patron
Kilo Patron

Hi @Vamshi_ch123 , 

Did you try with == instead of === operator. 

Add gs.log() in If condition and check which part is executing at run time.

 

-Thanks,
AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi Ashish,

 

Yes tried as below as well but still getting the same error 

(function transformEntry(source) {
    if (!source.u_serial_number || source.u_serial_number.toString() == "Undefined") {
        ignore = true;
    } else {
        return source.u_serial_number;
    }
})(source);
and without script it is working when i check with single record