- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 09:59 PM
HI All,
Could you please help me with below script. My requirement is that in table transform map I do have have one field called "Device type" and the data is for Device type is router, switch, firewall etc. So now my requirement is I would like to Run a script to send only Device type is firewall then the respective data only should be inserted into target table. After that I will map the fields accordingly. Can you please help at earliest.
Thanks,
Cnu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 02:51 AM
Hi,
So if device type is not firewall and not switch then you want to stop insertion?
you should use & condition for this.
if(source.device_type !='Firewall' && source.device_type !='Switch'){
ignore = true;
}
If you use OR then what will happen is when device type is firewall the first condition will evaluate as false and second will evaluate to true and total expression will evaluate to true and hence it will ignore record insertion which you don't want.
same will happen when device type is switch
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 10:06 PM
Hi,
So this you should do in onBefore transform script and not in field map.
if(source.<deviceTypeField> != 'firewall'){
ignore = true;
}
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2019 11:21 PM
Hi
u can write onBefore transform map script and field map.
write this script
if(source.device_type != 'firewall')
{
ignore=true;
}
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 12:18 AM
Hi All,
Thank you so much for your reply and it is working fine 🙂
I need to add one more condition i.e I would to get the data when the device type is either firewall or switch. I mean I need to write "or " condition in this if condition statement. So I have written like this but it is not working. can you please help on this one.
if(source.device_type !='Firewall' || source.device_type !='Switch'){
ignore = true;
}
Thanks,
Cnu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2019 02:51 AM
Hi,
So if device type is not firewall and not switch then you want to stop insertion?
you should use & condition for this.
if(source.device_type !='Firewall' && source.device_type !='Switch'){
ignore = true;
}
If you use OR then what will happen is when device type is firewall the first condition will evaluate as false and second will evaluate to true and total expression will evaluate to true and hence it will ignore record insertion which you don't want.
same will happen when device type is switch
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader