Skip to main content

KI-146

Relationship Role Configuration metadata records may create duplicate Account Contact Relationship records and raise errors

Created date

07/09/2025

Updated date

10/23/2025

Status

Done

Related work item

CC-4087

Description

Salesforce only allows one Account Contact Relationship (AccountContactRelation) record to be created between each Business Account (Account) and Person Account (Contact) record. If duplicate Account Contact Relationship records are created for the same Business Account and Person Account records, Salesforce will throw an error. However, there are two scenarios in which Care Connect may currently try to create duplicate Account Contact Relationship records via Case Field Configuration (mvn__PJN_Case_Field_Configuration__mdt) and Relationship Role Configuration (mvn__PJN_Relationship_Role_Configuration__mdt) metadata records, as detailed in the "Steps to reproduce" section below.

Affects version(s)

Care Connect Spring '25

Impacted capabilities

N/A

Steps to reproduce

Scenario 1: When an admin creates a Relationship Role Configuration metadata record for a business account and a person account and a user adds the Business Account and Person Account records to a Care Plan (Case) record, Care Connect creates a new Account Contact Relationship record with the specified role. If the admin then updates the name of the role on the Relationship Role Configuration metadata record and the user modifies and saves the Care Plan record, Care Connect tries to create another Account Contact Relationship record with the updated role. However, because an Account Contact Relationship record already exists for the same Business Account and Person Account records, an error is thrown.

  1. Create a Case Field Configuration metadata record for a business account. Alternatively, you may use the out-of-the-box Organization (PJN_Organization) metadata record.

  2. Create another Case Field Configuration metadata record for a person account (i.e., contact). Alternatively, you may use the out-of-the-box Patient (PJN_Patient) metadata record.

  3. Create a Relationship Role Configuration metadata record for the two Case Field Configuration metadata records created in steps 1 and 2. Make sure to populate the Role (mvn__PJN_Role__c) field. Alternatively, you may use the out-of-the-box Patient-Organization (Patient_Organization) metadata record.

  4. Ensure that the Case field that is referenced on the Case Field API Name (mvn__PJN_Case_Field_API_Name__c) field of the Case Field Configuration metadata record from step 1 is available either as a tile in Account Search or as a key field on the Care Plan record page. If you are using the out-of-the-box metadata records in steps 1-3, this is the Organization (mvn__PJN_Organization__c) field on the Case object.

  5. Enroll a patient into a care plan and populate the Case field from step 4 with a business account either through Account Search or on the Care Plan record page.

  6. Update the Role field on the Relationship Role Configuration metadata record from step 3.

  7. Update the care plan from step 5 but do not change the patient or the business account.

  8. Note the error message that appears when you click Save: "An error occurred while trying to update the record… This contact already has a relationship with this account…"

Scenario 2: When an admin creates two or more Relationship Role Configuration metadata records for the same business account and person account and a user adds the Business Account and Person Account records to a Care Plan record, Care Connect tries to create multiple Account Contact Relationship records for the same Business Account and Person Account records. As a result, an error is thrown.

  1. Create a Case Field Configuration metadata record for a business account. Alternatively, you may use the out-of-the-box Organization (PJN_Organization) metadata record.

  2. Create another Case Field Configuration metadata record for a person account (i.e., contact). Alternatively, you may use the out-of-the-box Patient (PJN_Patient) metadata record.

  3. Create a Relationship Role Configuration metadata record for the two Case Field Configuration metadata records created in steps 1 and 2. Make sure to populate the Role (mvn__PJN_Role__c) field. Alternatively, you may use the out-of-the-box Patient-Organization (Patient_Organization) metadata record.

  4. Create another Relationship Role Configuration metadata record with the same two Case Field Configuration metadata records created in steps 1 and 2. Make sure to populate the Role field with a different value from step 3.

  5. Ensure that the Case field that is referenced on the Case Field API Name (mvn__PJN_Case_Field_API_Name__c) field of the Case Field Configuration metadata record from step 1 is available either as a tile in Account Search or as a key field on the Care Plan record page. If you are using the out-of-the-box metadata records in steps 1-3, this is the Organization (mvn__PJN_Organization__c) field on the Case object.

  6. Enroll a patient into a care plan and populate the Case field from step 5 with a business account either through Account Search or on the Care Plan record page.

  7. Note the error message that appears. If you set the Case field through Account Search, the error message says, "Insert failed… This contact already has a relationship with this account…" If you set the Case field on the Care Plan record page, the error message says, "An error occurred while trying to update the record… This contact already has a relationship with this account…"

Workaround

Scenario 1: Update the Roles field of any existing Account Contact Relationship records to equal the new Role value on the Relationship Role Configuration metadata record. You may have to first add the Related Contacts related list to the Account page layout and record page and activate the new Roles value on the Account Contact Relationship object.

Scenario 2: Delete one of the two Relationship Role Configuration metadata records.

Fix version

Care Connect Fall '25

Resolution notes

If the Role value on an existing Relationship Role Configuration metadata record is updated or if there are multiple Relationship Role Configuration metadata records for the same account and contact, the Roles field on the corresponding Account Contact Relationship record will update to append the new or additional roles.