Tuesday, November 17, 2015

Junction Objects....what are they the junction between?

With SalesForce, as you have likely learned, it is easy to create new objects. Objects are like database tables in the traditional database sense. They let you store common information in fields structured in whatever way makes sense to your business. 

That being said, information is a silo is of little use to business. You need relationships to your other data in the system to build a complete picture. This is where relationships come into play. When creating a new field in SalesForce you will notice you can create a Master Detail field OR a lookup field. These two fields let you relate the records in your custom object to another a table. We will explain more about them in a moment.  

The challenge with both of the above types is that they only let you relate your data in one way. So, if you had a list of airlines and the classes of travel they offer, you would have to create a lot of records. Basically one per airline and class (eg British Airways - First, British Airways - Business, British Airways - Premium Economy, British Airways - Economy. That's four different records). But what if you wanted to be able to see all the airlines offering a Premium Economy class?  That is where you would use a junction object. With a junction object it lets you create multiple objects. So you could have the following:
- An object called Airlines that lists all the airlines
- An object called Classes that lists the various types of classes
- A junction object that lets you create a record that related both to Airlines and Classes. 

So now rather than having to have four records in the British Airways example above, you could create a record to relate the airline British Airways to each of the classes offered. Then you could relate those classes offered to other airlines and get a picture of how many airlines offer a business class by looking at the Class object and seeing how many airlines are related to the Business Class record. 

While a junction object isn't necessary, it certainly makes data analysis easier. You can see examples of junction objects SalesForce uses themselves by looking at Opportunity Contacts, or Account and Opportunity Teams.  Here is a sample of how you could use a junction object between JOBS and CANDIDATES if you were building an Applicant Tracking System.

The Job Posting to Applicant Link is the Junction Object
 
Now back to the question earlier about the relationship types. You can have a Master Detail field or a lookup field. Each has their own purpose. For example, with Contacts you would likely want a Master Detail relationship to Accounts so you can force that every contact has to be related to an account. However not every contact might be related to an Opportunity so that is when you would use a Lookup relationship since the relationship isn't required. 

Relationships in SalesForce are a powerful way to structure your data. So you should take the time to learn about them.

3 comments:

  1. Then you could relate those classes offered to other airlines and get a picture of how many airlines offer a business class by looking at the Class object and seeing how many airlines are related to the Business Class record. Sales Cloud Consultant

    ReplyDelete
  2. I am persisting to illuminate the Kaiser Permanente Employee Benefits and Perks with valuable information concerning Kaiser Permanente Employee Benefits Site, Kaiser Permanente Employee Benefits Packages...
    Kaiser Permanente Employee

    ReplyDelete
  3. AlaskasWorld is an online entry that gives you benefits whether you are grinding away, or at home. In this way, folks, you can see the full subtleties of Alaskasworld Employee Login the process at Employee Paperless Travel Login [PET] Login to get to Alaskasword Benefits.alaska airlines employee travel login

    ReplyDelete