Junction Object:
· J junction Object is an Object in salesforce it helps to maintain many-to-many relationship between two objects.
· Let's Create One Example: online Ecommerce Section Management
Custom Object:-Section__c
|
SectionID |
SectionName |
IsActive |
|
1 |
New coming Book |
true |
|
2 |
Best Deal |
True |
|
3 |
Deals Of The day |
True |
Custom Object:- ProductMaster__c
|
ProductID |
ProductName |
IsActive |
|
1 |
Iphone 5 |
true |
|
2 |
Iphone5s |
True |
|
3 |
Iphone6 |
True |
Custom Object:-SectionProductMaster__C
|
ProductSectionID |
SectionID |
ProductID |
|
1 |
1 |
3 |
|
2 |
1 |
4 |
|
3 |
2 |
1 |
SectionProductMaster__c is Junction Object For Section__c and ProductMaster__c Object.

Product Master Data


The Below image shows junction object Record (Many-to-Many relationships),

SOQL:
- select id,name,(select id from SectionProductMasters__r) from section__c
- select id,name,(select id from SectionProductMasters__r) from ProductMaster__c
Note: Junction objects allow you to track multiple records at once in either direction.Delete:
Whenever you delete a record from master object like Section__c, ProductMaster__c its automatically deleted over SectionProductMasters__c
OpportunityLineItem,PriceBookEntry are standard junction objects in salesforce.

saikrishna cherukuriPosted Mar 29, 2019, 1:28 AM
How to write query productmaster fields if i have sectionid