Customer is using an Import Rule to bring in Resources from a spreadsheet from Computer Manufacturer. Some assets result in this error: "An error occurred saving changes. "A resource with a duplicate field" within the 'Identity' data class already exists in the system."
Recent upgrade to 8.7.2
There is already a record in the Inv_Identity table for that computer with a blank System Number. The following query can be run to see what data the Inv_Identity table has for a computer:
select c.Name, i.*
from inv_identity i
join vcomputer c
on c.guid = i._resourceguid
where c.Name= 'ComputerName'
For this customer, the Computer Name is set to the Asset Tag of the system. Customer also wanted this to be the System Number. We can up with the following:
Workaround: Add the System Name as the System Number in the Identity Data Class when Saving the Item.
Issue Resolved for future: We added the Identity Data Class to the Import Rule and assign the Asset Tag as the System Number.
Fixing Previous Records: This proved to be more difficult as this makes changes to the database. The following query should work:
update i
set i.[System Number] = c.Name -- set System Number to be the Name of the system (System Name = Asset Tag).
from Inv_Identity as i
join vComputer c
on c.Guid = i._ResourceGuid
where i.[System Number] = '' -- only update Name if System Number is Blank in Inv_Identity
and c.Name = 'ComputerName' -- TRY this Once on a few systems and make sure it is correct.
-- AFTER TESTING, you can remove this last line and Update All empty System Numbers in the database