Use Case: Update All Related Contacts (Account Contact Relationship)
Do you have the Account Contact Relationship enabled for your org? Similar to the Email Message Relation, the Account Contact Relationship is like a junction object between Account and Contact. It enables the creation of many-to-many relationships. You no longer need to create duplicated contacts if they are linked to several accounts. Note that I said LIKE a junction object because it works the same but only has lookup instead of master-detail relationships. Today let’s dive into how to handle this object in Flow!
(See fields explanation of Account Contact Relationship)
* Big thanks to Brenda Buckner for sending in the case!
Lulu Mobile uses the standard Account object to track billing entities and the Contact object to track each sim card user. When there is a family package, each family member will be a separate contact. However, everyone will be under the same account using the Account Contact Relationship object. There is only one primary contact who is responsible for paying (poor guy), so this is the only person that the support will talk to. In each conversation, the support will then open this primary contact record and confirm all the information is up-to-date. If they update any of the fields, they want the system to automatically update all contacts under the same account.
(Assumption: One person will only be the primary contact of one account)
After understanding the data structure of the Account Contact Relationship, this will be a fairly easy flow to set up. We will use a Record-Triggered Flow to build the solution.
Record-Triggered | Get Records | Variable / Collection |
Loop | Update Records | Assignment |
Does the solution solve your problem? If not, write us what your problem is and we will build the flow for you!
Nice one! Im working on a similar solution. When a non related contact is added on an opportunity contact role of an account, this non related contact gets also attached of the related contact list of the account9
Glad to know Jaime!! 😀
This is really helpful! I was able to get my loop to work properly, but for some reason one of the records in the collection is not being updated. i.e. 6 of the 7 records are being updated properly. Have you experienced this issue before?
Nice to hear that it’s helpful! Have you combined the two assignments into one? If so, the variable would get added before it’s updated. Try to separate them into two to see if it helps. Otherwise we can try troubleshoot further
Excellent Article, Is it possible to Track Employee History in a separate tab under the Contact related list “Employee History”. I want to define Employee(Contact) & Employee(Account) relationship using the Account Contact Relationship. I have enabled the Account Contact relationship. Can you help with the flow to achieve this requirement?
Thanks in advance!
Thanks! I am a bit unsure what you mean by “track employee history in a separate tab”. Do you mind elaborating more?
I’m currently working on the Customer Community Portal for my org (we use Customer Community Plus License).
Use case: One account and related contact manages 3-4 other accounts/contacts.
Manager account ABC Capital manages the investments of
Account 1, Account 2, Account 3. ABC capital is parent account to these other accounts in the internal Account Hierarchy. OWD is currently set to private. Each account related contact will have the ability to log into the Community and view their own account records and other related records.
But when logged into the Community, I would like for the related contact of ABC Capital to be able to view the account/contact records for the accounts below him/her in the hierarchy. I do not want the users associated w/ Account 1, 2, or 3 to see each other’s records.
Hi Sam, this sounds like more of a experience cloud configuration problem, so suggest you consult your experts or product owners.
It does seem like a hierarchy and access setup, so I also recommend you checking out the External Hierarchy, Sharing Rules, or Sharing Sets.
I have a slightly similar use case. I need a record-triggered flow that will start when the Roles field on the account contact relationship object is changed, but it should only update the related contact if the Direct checkbox is true. I created a custom field on the Contact object called ACR Roles. That field should match what is in the Roles field on the direct ACR object even if it is blank. Can you help? Thanks!
Hi Sandra, in this case, you can create a record-triggered flow on ACR and the condition should be Role is changed and direct is true.
Then you can create a record variable for Contact object, and use Assignment to update the Contact Id and ACR Roles with the $Record variable.
Finally use a Update Records with the contact variable you created.
Hope this helps!
Is it possible to do the reverse, in which a change to data on the contact triggers an update to all of it’s related accounts? For example, if I change a custom field on John Doe, the flow updates a custom field on all of his related accounts?
Hi Derek, yes that’s totally possible! Step 4 you just need to get all ACR based on Contact Id, and then update each Account in the loop.
That’s so cool! Thank you so much! I will give it a try.
Hi! i have a business requirement where: I have Roles (billing, buyer) in the account contact relationship and the IsPrimary checkbox there. On the account i have Billing contact and shipping contact lookup fields.
what i want to do is. anytime the role in the account contact obj. is changed and made primary, this should override the exisiting BillTO and ShipTo contact on the account with the primary one.
Hi Bivush, unfortunately at this moment we are closing the support channel, however, for your case, it should be working if you tweak the current solution a bit. The flow should fire on the ACR object with condition IsPrimary = True (is changed to True), then update the Account with the Account Id from ACR record. Hope this helps!
I want to count the number of related accounts associated with a contact i.e create a rollup summary with flow. How will you build this?
Question, can you please use this certain use-case and formulate the Clear Problem Statement as you have illustrated in one of your earlier videos? I have included a snapshot for your reference. To be honest, I am confused.
Umair
is it possible to use this to create new records?
Yes! Just need to use Create Records element instead
Curious to know how you would apply similar logic using the Flow Components extension from app exchange that filters a collection based upon given criteria. https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FvN3wUAF
With Winter’23, I would probably just use an Update Records to update all contacts, using the IN operator. This solution should become a lot more concise with the new Flow enhancement
So I could use the IN operator to filter out a group of records that (for my use case) are account contact relationships which are child records of account. The tricky thing here is I don’t know how to filter them out. Since the list I’m getting is pulling based upon person accounts that has the main account in a custom field. The idea is to create new ACRs. Person accounts when initially created don’t have that relationship but the ones that are already there I was thinking grab all of them (child records of the main entity account) at once with one collection then filter out the ACRs somehow which is tricky since it’s on a different object yet all have the main entity account type in common.
Thanks for your help!
is it possible if account is inactive and need to check is it a direct contact to the account in accountcontact relationship object and need to upadte the contact as inactive(if contacts are morethan 100)
Im trying to do something similar with no luck AND I cant even seem to identify a record to debug with. Here goes:
I am trying to update AccountContactRelationship records when an AccountAccountRelationship record changes. Specifically, when the isActive checkbox changes. Right now I have a record triggered flow that runs whenever an AccountContactRelationship is updated and the isActive checkbox is changed from TRUE to FALSE. The flow then goes out and finds all the other AccountContactRelationship records where the Contact on the triggering record is also the Contact. Then, I loop through all of those AccountContactRelationship records and set the isActive checkbox on those records to FALSE. At least, thats the idea. It doesnt seem to work and I can’t even debug because I cant specify an AccountContactRelationship to use for the debug run. I try searching by the Contact and i just get a list of ALL the AccountContactRelationship relationship records and I have like over 250K of them. I also cant just find an AccountContactRelationship record by name, because there doesn’t seem to be a record name and the debug tool doesn’t recognize the recordId when I try to use that. HELP!