Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Need to modify the field script

suuriyas
Tera Contributor

HI Community,

 

I have written a field script in transform map, when class is t/a/ga/e then it should update as 'e'  which is working fine but when there is empty value from source then it should not update as e or ext currently i guess it if the class is empty then it is updating as ext but it should update as empty 

 

How can i modify the script:

answer = (function transformEntry(source) {

   
    var zone = source.u_employee_class; // (u_employee_class is the field in source table)
    if (zone == "T" || zone == "A" || zone == "GA" || zone == "E") {
        return "E";
    } else
        return 'EXT';

})(source);
10 REPLIES 10

It's a modified version of your script, just with additional checks, I have also added comments to show you what the particular line is doing. 

 

You can change your script to what I sent and run the transform map again