Transform script for True/False field in Target table.

Mrman
Tera Guru

Hi ,

Can some one let me know if my below Onbefore transform script is fine for setting Boolean field(Type = True/False) on my Target table when source field has some data.

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {

var srcm = source.u_ci_managed_by;
if(srcm.isNil()){
  answer = true;
}

else{
  answer = false;
}

})(source, map, log, target);

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could try something like this:



(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {



      var answer = false;


      var srcm = source.u_ci_managed_by;


      if (srcm.nil()) {


              answer = true;


      }



      return answer;



})(source, map, log, target);



You just need to make sure to return the answer.


View solution in original post

2 REPLIES 2

DUGGI
Giga Guru

see this


File:Field map source script.png


Brad Tilton
ServiceNow Employee
ServiceNow Employee

You could try something like this:



(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {



      var answer = false;


      var srcm = source.u_ci_managed_by;


      if (srcm.nil()) {


              answer = true;


      }



      return answer;



})(source, map, log, target);



You just need to make sure to return the answer.