Transform script help... Again. :)

Andrew_TND
Mega Sage
Mega Sage

Hello again... I need some help because its not my week. 

I've written a onBefore script for a transform map to ignore lines with the following conditions

u_compliancestate is not Compliant
Assigned to.active is not false
u_osversion that start with 10.0.1

However I've ran it a few times its no joy... Any thoughts? 

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

    if (source.u_compliancestate != 'compliant' && !target.assigned_to.active && !source.u_osversion.startsWith("10.0.1")) {

        ignore = true;
    }


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

1 REPLY 1

Hemanth M1
Giga Sage
Giga Sage

Hi @Andrew_TND ,

 

First i would check if condition is satisfied  by introducing some log statements inside if block.

like:

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

    if (source.u_compliancestate != 'compliant' && !target.assigned_to.active && !source.u_osversion.startsWith("10.0.1")) {
      gs.info("Iinside if  >>"+" "+source.u_compliancestate+ " "+target.assigned_to.active+" "+source.u_osversion);
        ignore = true;
    }


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

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025