Junction Objects Scenario 1: Real Estate Agent and Property Assignment
A real estate agency wants to manage their property listings. They have two custom objects: “Property” and “Agent.” They want to track which agents are responsible for selling or renting each property, and they also want to record the date when an agent is assigned to a specific property.
Solution
Create a junction object named “PropertyAssignment__c” that establishes a many-to-many relationship between “Property” and “Agent.” The “PropertyAssignment__c” object will have fields like “AssignmentDate” to store the date when each agent is assigned to a specific property.
Step 1: Configure Property Object
Object Name: Property
API Name: Property__c
Object Description: Capture property details including Name, Property Type, Address etc.
Instructions to follow:
1. In your developer org, go to Object Manager and select Create > Custom Object.
2. Name your object Property and set the plural label to Properties.
3. Provide a brief description for context.
4. Ensure the object is marked as Deployed.
5. Click Save to create the object.
Step 2: Configure an Address Custom Field on the Property Object
Field Name: Address
Label: Address
API Name: Address__c
Field Type: Text(Area)
Object: Property
Description: Stores the address of the property.
Instructions to follow:
1. In the Object Manager, find the Property object and click on Fields & Relationships.
2. Click New to create a new field and select Text as the field type.
3. Label the field as Address and set the maximum length to 255 characters.
4. Provide a description, for example, “Stores the property’s address.”
5. If the address must be unique and required, tick the respective checkboxes.
6. Skip default value settings, as it’s not needed for this setup.
7. Ensure the field is accessible to the System Admin profile.
8. Confirm the field is added to at least one-page layout.
9. Click Save to complete the field creation.
Your ‘Address’ field is now configured and will hold property addresses within your system.
Step 3: Configure Agent Object
Object Name: Agent
API Name: Agent__c
Object Description: Capture real estate agents’ details including personal information, performance metrics etc.
Instructions to follow:
1. Go to the Object Manager and select Create > Custom Object.
2. For the object name and label, enter Agent.
3. Set the plural label to Agents to differentiate individual records.
4. Add a description that outlines the object’s use, such as “Capture real estate agent’s details.”
5. Scroll to the bottom and click Save to create the Agent object.
Step 4: Configure an Email Custom Field on the Agent Object
Field Name: Email
Label: Email
API Name: Email__c
Field Type: Email
Object: Agent
Description: Stores the email of real estate agent.
Instructions to follow:
1. Within the Object Manager, locate and select your Agent object.
2. Click on Fields & Relationships and then on New to create a new field.
3. Choose Email as the field type from the options provided.
4. Name the field Email and provide a label with the same name.
5. Add a description for context, such as “The agent’s primary email address.”
6. Proceed by clicking Next, review your settings, and click Next again.
7. Finally, click Save to add the email field to your Agent object.
Step 5: Configure Property Assignment Object
Object Name: Property Assignment
API Name: Property_Assignment__c
Object Description: Establishes a many-to-many relationship between “Property” and “Agent” objects.
Instructions to follow:
1. Return to the Object Manager in your developer org.
2. Click on Create, then select Custom Object to start a new object.
3. Label the new object as Property Assignment.
4. Set the plural label to Property Assignments for multiple records.
5. Provide a clear description, for instance, “Establishes a many-to-many relationship between ‘Property’ and ‘Agent’ objects.”
6. Click Save to create the Property Assignment junction object.
Step 6: Configure a Property Agent Custom Field on the Property Assignment Object
Field Name: Property Agent
Label: Property Agent
API Name: Property_Agent__c
Child Relationship Name: Property_Agents
Field Type: Master-Detail Relationship (related to the Agent object)
Object: Property Assignment
Description: Establishes a link to the corresponding Agent for the Property.
Instructions to follow:
1. In the Object Manager, select your Property Assignment object.
2. Click on Fields & Relationships, then New to add a new field.
3. Choose Master-Detail Relationship as the field type and click Next.
4. Set the related object to Agent to establish the connection.
5. Label the new field as Property Agent and use the same name for the Field Name.
6. Describe the field as “Establishes a link to the corresponding agent for the property.”
7. Assign the child relationship name as Property Agents.
8. Proceed through the next prompts, ensuring the field name includes an underscore (Property_Agent).
9. Continue clicking Next to add the field to the page layout.
10. Click Save to finalize and create the master-detail relationship on the junction object.
Step 7: Configure a Property Custom Field on the Property Assignment object
Field Name: Property
Label: Property
API Name: Property__c
Child Relationship Name: Property
Field Type: Master-Detail Relationship (related to the Property object)
Object: Property Assignment
Description: Establishes a link to the corresponding Property.
Instructions to follow:
1. Access the Property Assignment object again within the Object Manager.
2. Click New in the Fields & Relationships section to create a new field.
3. Select Master-Detail Relationship and proceed by clicking Next.
4. This time, choose Property as the related object to link to.
5. Label this new field as Property and use the same name for the Field Name.
6. For the child relationship name, also use Property.
7. Provide a description, such as “Establishes a link to the corresponding property.”
8. Click Next through the subsequent screens to confirm your settings.
9. Save your changes to create the master-detail relationship field.
With this step completed, your junction object now has a ‘Property’ field, creating a direct connection to the property data within your system.
Step 8: Configure an Assignment Date Custom Field on the Property Assignment Object
Field Name: Assignment Date
Label: Assignment Date
API Name: Assignment_Date__c
Field Type: Date
Object: Property Assignment
Description: Capture the date when each agent is assigned to a specific property.
Instructions to follow:
1. Within the Property Assignment object in the Object Manager, click New to add a field.
2. Select Date as the field type and click Next.
3. Name the field Assignment Date.
4. Enter a description, such as “Captures the date when an agent is assigned to a specific property.”
5. Click Next to review your settings, then click Next again.
6. Click Save to add the Assignment Date field to your object.
The ‘Assignment Date’ field is now established, allowing you to track when agents are assigned to properties.
For more Junction Object Scenarios to practice, checkout saasguru’s Salesforce labs –
Practice Salesforce scenarios and validate your skills directly within your developer org. With saasguru’s Salesforce Labs, you can engage in hands-on practice and validate each step of your journey in real-time.
Explore saasguru’s Salesforce Labs to make learning interactive, practical, and instantly validating.