Contact to Account Membership Sync

Contact to Account Membership Sync

The managed package includes the active record-triggered Flow Contact to Account Membership Sync (b3s__Contact_to_Account_Membership_Sync). It runs after a Contact is saved and ensures a b3s__Account_Membership__c links the Contact to its current Account, creating one only when none exists.

When it runs

Contact operation Result
Create with an Account Create a membership only if missing
Create without an Account No membership
Change Account to another Account Delete memberships for the previous Account, then create a membership for the new Account only if missing
Assign an Account to a Contact without one Create a membership only if missing
Clear Account Delete memberships for the previous Account; create none
Edit other fields without changing Account No changes

The new membership sets b3s__Contact__c to the Contact and b3s__Account__c to its current Account. User Profile stays blank; this membership alone grants no portal permissions. Include Child Accounts uses its default of false.

Existing memberships

When Account changes, the Flow deletes all memberships linking this Contact to its previous Account, including duplicates and memberships with a User Profile. It then checks for an existing membership linking this Contact to the current Account. If one exists, it leaves that membership and its User Profile unchanged. Otherwise, it creates a new membership with User Profile empty. Clearing Account deletes the previous Account's memberships without creating a replacement. Memberships for other Accounts and other Contacts remain unchanged.

Deleting profiled memberships removes the permissions those memberships granted. The Flow does not copy the previous User Profile to the new membership. Portal user provisioning queries memberships after creating the Contact and applies the selected User Profile to an existing membership for each selected Contact–Account pair. It inserts a membership only for selected Accounts without one, so the Flow-created home membership is reused.

Existing Contacts are not backfilled on installation. The Flow prevents creating an additional membership when one already exists for the destination Account. It does not clean up pre-existing duplicates or enforce uniqueness on records created by other automation.

Verification after installation

In Salesforce Setup, open Flows and confirm Contact to Account Membership Sync is active. Create a Contact with an Account, then inspect its Account Memberships and confirm the Contact and Account links and blank User Profile. Change the Contact to a second Account and confirm a new membership appears and all memberships for the previous Account are removed, including profiled memberships. Clear Account and confirm its memberships are removed without a replacement. Editing an unrelated field should leave memberships unchanged. Also confirm that memberships for other Accounts and other Contacts remain unchanged.

To verify duplicate prevention, first give the Contact a membership for a different Account with a User Profile assigned. Change the Contact's Account to that Account. Confirm no additional membership is created, the existing User Profile is preserved, and memberships for the previous Account are deleted.