- My View
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?
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.
Please hit Like, Helpful, or Correct Answer
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?
Sushant Ram Malsure
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');
gs.addErrorMessage("A DEVICE WITH THAT NAME ALREADY EXISTS, PLEASE SEARCH THE CMDB BEFORE CREATING NEW RECORDS");
I am importing into cmdb_ci_server table. I agree that this will not coalesce.
Below is the extension of tables:
cmdb_ci_server extends Computer extends Hardware extends cmdb_ci
I have done similar insert earlier, where I do not have to add additional scripts/business rules to accomplish this.
You could import to cmdb_ci and then define the CI class in the transform map, i've not tested so not sure if that would correctly populate the right tables though.
The advantage of having the business rule is that it will cover any manually added CI's as well as those imported.
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!
Lol ok you're welcome. Here's another hint; try marking correct the answer to your question rather than your response to the answer to your question!
Try changing the choice action for the coalesced field to Ignore.
Hit Like or Correct on the impact of response.
Did not help Jaspal