Skip to content

fix CreateOrUpdateRelationship to handle symmetric relationships

The "Create or Update Relationships" action doesn't handle symmetric relationships (e.g. "Spouse of-Spouse of") correctly.

Steps to Replicate

  • Create a new Form Processor with 2 integer inputs "Contact A" and "Contact B".
  • Create an action "Create or Update Relationships" and make the Relationship Type a symmetrical one ("Spouse of", "Sibling of", etc.).
  • Go to Try Out and submit the form with two individual contact IDs.
  • Submit the form again, but reverse the two contact IDs.

Expected Result

The relationship only exists once.

Actual Result

The relationship exists twice.

Comments

The RelationshipCache entity was created to make this sort of issue much simpler. I was also able to simplify the $also_inactive handling.

Merge request reports

Loading