Creating Many to Many relationship between the accounts records in salesforce

0 votes
Is there a method to link one account record to multiple additional account records in Salesforce using a many-to-many relationship format? We can't construct many-to-many relationships with the same object type in Salesforce, therefore this isn't doable the traditional method. Could someone please offer a special method or code to accomplish this? I have a need to link Account A with Account B and Account C, for example, so that I may access Account B and C's contacts on Account A.
Mar 10, 2022 in SalesForce by surbhi
• 3,820 points
1,345 views

2 answers to this question.

0 votes

In Salesforce, you'll need a joiner object with two master-details to account for a many-many relationship (There is actually already a standard object called Partner that may fit your needs).

It's definitely easier to construct a simple visualforce page that queries and displays the contacts of connected accounts to see the contacts of associated accounts.

Elevate your career as a Salesforce Platform Developer with the industry-leading Salesforce Platform Developer1 Certification.

answered Mar 17, 2022 by CoolCoder
• 4,420 points
0 votes

In Salesforce, it is not possible to directly create a many-to-many relationship between two records of the same object type (e.g., Account to Account). However, you can use a junction object to achieve a similar effect. A junction object serves as a bridge between two objects and allows you to establish many-to-many relationships. Here's how you can accomplish this:

Create a custom object to serve as the junction object between the Account records. Let's call it "Account Junction" for this example. This object will have two master-detail relationships, one to Account A and another to Account B/C. Additionally, you may want to add any other relevant fields to the junction object if needed.

Hope this helps!

Enroll for the salesforce admin certification here!

Thanks!

answered Jun 19, 2023 by Khan Sarfaraz
• 700 points

Related Questions In SalesForce

0 votes
0 answers

How to find the difference between sandbox and production in salesforce

I have some action that if I ...READ MORE

Mar 30, 2022 in SalesForce by surbhi
• 3,820 points
685 views
0 votes
1 answer

In Salesforce what is the difference between Page Layouts and Visual force Pages?

A built-in standard mechanism for displaying information ...READ MORE

answered Mar 9, 2022 in SalesForce by CoolCoder
• 4,420 points
799 views
0 votes
1 answer

In Salesforce Whats the difference between Page Layouts and Visual force Pages?

A built-in standard mechanism for displaying information ...READ MORE

answered Mar 9, 2022 in SalesForce by CoolCoder
• 4,420 points
435 views
0 votes
1 answer

What is the difference between Queues and team selling in salesforce?

Because they're used for entirely different purposes. "Unassigned ...READ MORE

answered Mar 15, 2022 in SalesForce by CoolCoder
• 4,420 points

edited Jun 27, 2023 by Khan Sarfaraz 800 views
+2 votes
2 answers

Salesforce Interview questions

Here are some questions very important for ...READ MORE

answered Jan 11, 2019 in Career Counselling by Suresh
• 720 points
3,459 views
0 votes
1 answer

How to connect to salesforce from tableau?

Hi, follow these steps to connect to Salesforce: 1. ...READ MORE

answered Mar 25, 2019 in Tableau by Cherukuri
• 33,030 points
1,069 views
0 votes
1 answer

Power BI - Salesforce

Hi, Follow below steps: 1. Go to Data source. 2. ...READ MORE

answered Mar 25, 2019 in Power BI by Cherukuri
• 33,030 points
786 views
0 votes
2 answers

What is the best training for Salesforce ADM-201 Exam?

Hi @Vardhan, I took Edureka's Salesforce Online Training, ...READ MORE

answered Jun 3, 2021 in Others by Jaya
• 140 points

edited Dec 22, 2021 by Soumya 748 views
0 votes
1 answer

Trigger to Count records in self relationship salesforce

You should only use triggers if you ...READ MORE

answered Mar 9, 2022 in SalesForce by CoolCoder
• 4,420 points
1,288 views
0 votes
1 answer

how to find the difference between sandbox and production in salesforce

It could be a validation rule or ...READ MORE

answered Apr 1, 2022 in SalesForce by CoolCoder
• 4,420 points

edited Jun 27, 2023 by Khan Sarfaraz 1,493 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP