The following errors appear when trying to delete companies from ITAM:
"You cannot delete this object, since it is referenced by other objects."
"The CA provided 'company name' cannot be deleted."
ITAM 17.x
The companies that were in question were created using the CA SwCM (Software Compliance Manager) which was used to create, manage, and audit software licenses. This product was retired in 2015.
You need to perform two steps below in the database to be able to delete the companies.
Get the companies' company_uuid and source_type_id using below query:
Select company_uuid, source_type_id, * from ca_company where company_name like '%<Company Name>%'
Example for: "CompanyTest1" with company_uuid 0x123456789123456789123456789123456
Select company_uuid, source_type_id, * from ca_company where company_name like '%"CompanyTest1"%'
For purposes of example, the UUID we will use is "0x123456789123456789123456789123456"
Step 1: Set the source_type_id=2 if source_type_id=3
UPDATE ca_company SET source_type_id=2 WHERE source_type_id=3 AND company_uuid=0x123456789123456789123456789123456;
Note: In the backend, few companies could be created with source_type_id = 1 (which are imported using CA SwCM) or source_type_id = 3. We need to set it to '2' and only then they will be allowed for deletion.
SQL Query if the source_type_id=1
UPDATE ca_company SET source_type_id=2 WHERE source_type_id=1 AND company_uuid=0x123456789123456789123456789123456;
Step 2: Set the manufacturer_uuid = null in ca_software_def table where manufacturer_uuid=<company_uuid>
UPDATE ca_software_def SET manufacturer_uuid = null WHERE manufacturer_uuid=0x123456789123456789123456789123456;
You need to make sure that these companies are not being used anywhere in their active system.
Note: To remove references to these companies, we need to remove the software-manufacturer association in the ca_software_def table.
You need to do it for each of the company records (different company_uuid) that are throwing either/both of these errors while deleting.
Please perform a backup of the database before any changes are made, and test in a non-prod environment to familiarise yourself with the procedure.