- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 09:15 AM
Hello Everyone,
I will be uploading asset data into ServiceNow using an Excel spreadsheet and a transform map. I am trying to determine if it possible to restrict new records being inserted on the associated tables during the upload. The asset information should only be updated with data that exists on the associated tables.
For example, if the spreadsheet had a model that wasn't in ServiceNow as a record, I would want that insert to be ignored.
Please let me know your thoughts on what the best way to go about this would be. My understanding is that you can configure an onBefore Transform map to potentially do something like this but I don't know where to begin. Thank you.
Tables that we want to restrict insert on if the record doesn't exist in the table.
- Location
- Stockroom
- Model
- Model Category
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 10:21 AM
Ok..I think I understand waht you are saying.
Make sure you have the choice action set to ignore for those field mapping, as shown below
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 09:41 AM
You can write an onBefore transform script, for ex
if(action =="insert" && (target.sys_class_name =='cmn_location')){ ignore = true; }
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 10:13 AM
Hello Sanjiv,
Thank you for your reply. I have created an onBefore transform script on my existing transform map using the code provided. However even with the new onBefore script, I uploaded a test asset record into my instance with a location that does not exist in the location table and the new record "Funky Town" was created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 10:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2020 10:44 AM
Hi Sanjiv,
Looks like that was the solution. I turned off the onBefore script and just set the Choice action for the location field to be "ignore". When I uploaded an asset record with a location that doesn't exist in the table, the new location was not created. I also tested if it was still going to update the location field if the asset record I upload used an existing location, and the update went through as expected.