multiple if condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2022 03:31 PM
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;
}
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2022 05:31 AM
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
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
Regards,
Shloke