In this article we are going to create Many to Many Relationships between courses and classroom. In salesforce if we want to create Many to Many relationship we want a Junction Object. Junction Object will be Course Offering in our training tutorial .
In order to establish Many to Many Relationship between Classroom and Course we are sing Course Offering Object as junction Object.
What is Junction Object ?
In salesforce Junction Object are the part of the objects which joins one object to another. These are specially used to join many objects in Many to Many relationships.
How to create Many to Many Relationships in Salesforce.
Creating Many to Many Relationships in salesforce is very easy but we have to keep little bit concentration on he process of creation. In this Training tutorial we are going to know every thing about Many to Many relationships, what is cross field object, how to create cross field object .
Before going to create Many to Many Relationship we have to create 3 custom objects namely Course, Course Offering, Class Room. Course and Classroom objects are Master objects, Course offering objects is meant for Junction Object.
After creating three custom objects now we have to create custom fields in them. Create the list of fields in Custom objects listed below.
- Course starting date.
- Course Last date.
- Current Seats Occupied.
- Maximum Seats Occupied.
After creating those custom fields in their Custom Objects w have to establish link between those object. This is the to create Many to Many relationships.Go to Junction Object(Course offering) create Master-Detail Relationship related to Classroom.
Select Next. Enter all the details Field label and Field name provided below.
Then press Next =>Next Finally Save it.
Now we have to create another Master-Detail Object in Junction Object(Course offered Object).
Finally Save it.
Go to Objects we are able to view to relationships created for Junction Object.
Now go to Classroom tab to create new Records and fill all the details given
Now go Detailed view of the record in Course object that we crated and we observe child Object (Course offering). We are not shown full details in that. Edit page layout to display below details.
Now go to detailed view of the record in Classroom Object.
The above shown Course offering is the Junction Object. Edit page layout. But we are not able to find Maximum Seats Occupied field in the available fields. In earlier when we edit page layout for Course object we have Maximum seats Occupied field but we are not having any Such type of field. So here comes the concept of Cross fields.
By creating Cross Formula field in Junction object we can arrange that Maximum seats occupied in layout.
Enter the details given above.
Now we can find Maximum seats occupied field.
Go to Classroom fields in detail view. Now edit the page layout.
All the details available now. Successfully we have created Many to Many Relationships.