
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2018 06:04 AM
I have a spreadsheet of hardware assets that I need to import. Each of the assets is related to a contract that exists in the contracts table. I have the contract number included in the hardware asset import spreadsheet for each asset.
How do I import the assets into the table [alm_hardware] and connect each asset to its corresponding contract through the import.
I am not interested in adding the contract to each asset manually as there is over 3500 assets. Also, I am not interested in adding the assets to the contracts manually as there is over 3500 assets.
I'm looking for how to do this with an import set and transform map.
Here is some example data
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2018 12:49 PM
Hi Robin, is this solution works for you? If yes, please accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2018 09:13 AM
On alm_hardware table, Create a Field called Contract and reference this field with Contract Table. Now when ever you do import, MAP this new field on with the contract data field in the data source. When you do upload, all contract records will be linked as required.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2018 09:20 AM
Thank you for replying. I'm afraid that's not what I'm looking for.
Hardware Assets already have a Contracts tab where you can manually associate a hardware asset to a contract. The relationship between hardware assets and contracts can be 1 to many, so a reference field doesn't cut it.
What I need to know is what do I need to do in the import set or the transform maps to get the contracts populated in the asset record when I do the import?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2018 11:25 AM
Two Options you can do (with code and without code)
1. Write a code in existing transformation MAP to make entry of Asset name (Created after import) and Contract in "clm_m2m_contract_asset" table.
onAfter |
When: The onAfter event script is processed at the end of a row transformation, after the source row has been transformed into the target row and saved. |
https://docs.servicenow.com/bundle/jakarta-platform-administration/page/script/server-scripting/reference/r_MapWithTransformationEventScripts.html
2. MAP Comments field of Hardware table to have Contract data and Upload all data in Hardware table
Once all data get uploaded in Hardware table, personalize table list view and select only Asset Name and Comment. Now download all records with Asset Name and Comments (having contract information).
Again upload this data into clm_m2m_contract_asset table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2018 12:49 PM
Hi Robin, is this solution works for you? If yes, please accept the solution.