How to allow duplicate entries on core_company table

SandyL83
Tera Guru

Hello, I am trying to allow duplicate entries on the core_company table (some companies have the same name but different contacts, some are vendors some aren't ,etc)

I'm getting the following error message if I try to create an entry where the name field is the same. 

Error MessageUnique Key violation detected by database ((conn=1074061) Duplicate entry

"Unique" is set to false on the settings for that column. 

 

Tank you!

5 REPLIES 5

brian_rowland
Giga Guru

Hello @SandyL83,

The issue you're running into is most likely driven at the Dictionary, not in the Business Rules you posted.  It does appear a column in your table has the unique attribute set true.  Take a look at the hash field since that field is driven by the Company.Name.  On the instances I checked, hash was not set to Unique, but the error implies that there is one, or you're attempting to insert a Company that already exists by sys_id.

However, having two or more Company records with the same name will ultimately cause problems if you want to leverage the Content Data Service (CDS) for SAM, HAM, TRM, etc. because the CDS leverages the hash of a company name (or other normalized field) to manage the linkages between variants and the canonical record.

As far as the two BRs you've posted, the first simply sets the hash value for the company based on the name value by calling an internal Java method CanonicalUtil.getHash().  The second manages the insertion of a new Company record's relationship to normalization rules if enabled by the glide.cmdb.canonical.company.enabled system property.  The BR checks the new Company record against Client Mapping (cds_client_mapping) records to see if the CDS has already created one against an existing canonical company, otherwise it creates the new company record as a canonical Company.  

 

Good luck,

-Brian