multiple if condition

Praveen75
Tera Contributor

Hi guys, I am trying to have the transform script where my source field is string and the target field (target.pcode) is of choice type (7 fields). I need help on how to write this in script in order to evaluate the correct data map between two fields. Thanks

var pdata = source.u_postalcode.toString();
if(pdata == 'AB' || pdata == 'CD' || pdata == 'EF' || pdata == 'GH' || pdata == 'IJ' || pdata == 'KL'|| pdata == 'MN'){
ignore = false;
} else {
ignore = true;
}

 

5 REPLIES 5

shloke04
Kilo Patron

Hi,

Why do you need a script in this scenario. If the ask is just to evaluate if the choice match then it will update else it will ignore.

You just need to set this field to Ignore in the field map itself as shown below:

1) Open your Field Map record and update this field to Ignore

find_real_file.png

ServiceNow will automatically take care that if value does not match it will ignore else it will allow to update the choice action field.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke