- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2017 04:34 AM
I am inserting CIs using Web Services into Import Set tables. Transform maps is created to insert it in to different CI classes. After insertion, I am seeing a duplicate entry with class type u_computer_historical in the CI table. Refer the screenshot. CI is inserted into Windows Server, but there is a duplicate at the same time.
Anyone has came across this and what is the solution to remove these duplicates?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 05:28 AM
Hi Dave,
This worked. I had Script within Transform Map which will define the sub-class of a CI record under cmdb_ci_server.
Initially, target table in Transform Maps was cmdb_ci_server. I updated this to cmdb_ci and left the Script in Transform Maps as it is.
Thanks for the hint!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2017 11:00 AM
If you have a transform map, and you consider the above records duplicates, then you should be coalescing on the name field. this will cause the import process to treat the name field as the primary key of the records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 12:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 12:40 AM
can you check if Name is difference?
meaning: any extra space is there in any of the 2 records in name field value?
because if coalesce is there then transformation should happen based on primary key.
you may also want to check if multiple fields are having coalesce = true in transform map?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 01:06 AM
Hi Prabhu,
What table are you importing to? If you're importing to cmdb_ci_server but there's a record in u_computer_historical then it won't coalesce.
Is u_computer_historical extending cmdb? If so you can add a business rule to the cmdb table to run before insert with the below script. As long as the name field on both tables is extended from the base cmdb table and you have set business rules to run on your transform map it will reject any duplicates that come in on the import.
var gr = new GlideRecord('cmdb');
gr.addQuery('name',current.name);
gr.query();
if(gr.next()) {
current.setAbortAction(true);
gs.addErrorMessage("A DEVICE WITH THAT NAME ALREADY EXISTS, PLEASE SEARCH THE CMDB BEFORE CREATING NEW RECORDS");
}