How to Create Self Relationship in Salesforce
Self relationships in Salesforce allow a record within an object to be related to another record of the same object, such as linking an employee to their manager within the Employee object. This is implemented by creating a lookup relationship field that references the same object, enabling hierarchical or relational data structures without complex configurations. The explanation includes when to use self relationships, types of Salesforce relationships, and step-by-step guidance to create and configure this relationship, including use of lookup filters and field-level security. Salesforce admins and consultants can leverage this pattern to represent hierarchies or linked records within one object, enhancing data modeling and reporting capabilities.
- Create self relationships using lookup fields on the same Salesforce object.
- Use lookup filters to restrict visible records in the lookup field.
- Label fields clearly to reflect the relationship role (e.g., Manager, Parent Account).
- Add related lists to page layouts to show child or linked records.
- Consider validation rules or automation to prevent circular references.
When working with Salesforce objects, we often need to show how records are related within the same object. In companies, every employee reports to a manager, who is also an employee of the same company. This means we need to connect one Employee record to another Employee record. In Salesforce, both records are stored in the same Employee custom object . To create this connection, we add a Lookup Relationship field on the Employee object and choose Employee again as the related object. This setup is called a Self Relationship because a record is linked to another record of the same object. For example, Alex is a junior employee, and his manager is John. Both Alex and John are records in the Employee object. In Alex’s record, we select John in the Manager lookup field. This creates a reporting structure, such as Employee > Manager, within a single object. In this article, I will explain how to create self relationship in Salesforce .