Send the data to Target table based on condition is Transform Map Run Script

cnu1916
Kilo Explorer

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.

find_real_file.png

 

Thanks,

Cnu

1 ACCEPTED SOLUTION

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

12 REPLIES 12

Hi,

This is weird though. you are updating/inserting into target table and not source table. can you check target table is set properly or not.

What happens for target table? are records getting inserted based on conditions properly.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Yes I am updating/inserting target table only but Source table as well is inserting with duplicate records. 

What happens for target table? are records getting inserted based on conditions properly. --> Yes

find_real_file.png

find_real_file.png

find_real_file.png

 

Hi,

This should not happen. just check for some other data source as well. If issue still persists then contact ServiceNow team.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader