login

Tip of the Week

Tip of the Week – Deciding between Master-Detail and Lookups in Salesforce

So you’ve finally decided to take the leap and create a custom Object (or more ambitious, an app) in Salesforce? Congratulations! Since you’re probably going field-crazy already, don’t let me stop you, but I would like to jump in and give you some practical advice. One of the most critical decisions you’re going to make in development of your Object is how it should be related to other Objects in Salesforce, and many budding admins and developers are at a loss when it comes to choosing between a Lookup and a Master/detail relationship. Here are some guidelines which should help you make that decision.

The primary difference between Lookups and Master/detail relationships is one of depth. Master/detail relationships are deep connections, and as such, a value is always required for that field. There is no such thing, for example, as an Opportunity Product without an associated Opportunity, and so that would be Master/detail. This deep connection allows you to do things like create Rollup Fields to count and summarize data from the child objects on the master. Alogn with Rollups, Master/detail children inherit their permissions from their parent, and if you delete the parent, all children will also be deleted. But because of the depth of the connection, you can only create Master/detail relationships that go so deep – you can only have up to three detail levels. Lookup Relationships are looser – they’re not required by the system, they can look up to other records on the same Object, and you can go as deep as you want. But with this flexibility comes limitations. There are no standard Rollup features on Lookup relationships, so if you need rollups, you’ll need code or a 3rd party app to do the job. Check out Salesforce’s help doc on relationships for more details and advice, and good luck with your new customizations!

-Jared and the Salesforce Guys

, , , , , ,

One Response to Tip of the Week – Deciding between Master-Detail and Lookups in Salesforce

  1. Michele June 28, 2019 at 6:00 am #

    Hi Jared, having just crammed some learning about the different types of relationships in SF so that I can create my custom object, your article was the perfect answer to my question: so which type do I use? Thank you! No matter how much you know about the different types, that knowledge is kind of useless if you can’t apply it in a common sense/best practice way to the task at hand. Thank you, again! Now I’m ready to get started. 🙂

Leave a Reply