Lookup fields
Lookup fields help you build an integrated system by connecting different objects. This allows you to easily track where every record belongs and any system records which are related to it.
By using lookup fields, you can easily relate records to each other, and create one to many relationships. For example, the Accounts object is related to the Contacts object using the built in Account field in the Contacts object. This creates a relationship where you can choose one account for each contact to be related to, and every account can have multiple contacts related to it.
Create a new lookup field
To create a new lookup field, you’ll need to choose the object you’d like to relate your current object to. For example, you can create a campaign lookup field in the Projects object. This will create a one to many relationship, where each project can be related to one campaign, while each campaign can be related to multiple projects.
First open the object you’d like to add your new field to, such as the Projects object. For further instructions, see our object studio article here. Now use the Add button in the Record fields view on the bottom section of the page to open the Create New Field dialog box. Here, in addition to the regular field types, you’ll find all the default and custom objects in the system under the Advanced heading. Search for and click on the name of the object you’d like to create a lookup field for, such as the Campaign object. You can then set the Field Name and all the Field Settings.
Your new campaign field will let you use the magnifying glass to search for and choose one Campaign record to connect your current Projects record to. You can even add a new campaign by clicking the Add button on the top left. You’ll be able to easily access the related campaign record by clicking on it. The campaign lookup field’s value will automatically display the selected campaign’s primary field, which is the name in this case. To view all the projects which are related to a campaign, click on the Projects icon from the related multi component in a campaign’s page. Find a more detailed explanation below.
For details on how to edit an existing field and general field settings, click here. The lookup specific settings and uses are explained below.
Filter by field
By default, a lookup field will display and allow you to choose any record within the related object. Using the above example, you’d be able to relate a project to any campaign record which exists in the system. The Filter by Field option lets you set a filter so that the lookup field will only allow you to choose certain records within the related object. To set up a filter, you’ll need three different lookup fields:
- The lookup field within the current object which you’d like to add a filter to. For example, the Campaign lookup field which is in the Project object and relates to the Campaign object.
- A lookup field within the current object, which relates to the object you’d like to filter by. For example, if you’d like to filter by system users, you can use the Project Owner lookup field which is in the Project object and relates to the User object.
- A lookup field within the related object of the lookup field you’d like to add a filter to. This lookup field will need to relate to the object you’d like to filter by. For example, the Campaign Owner lookup field, which is in the Campaign object and relates to the User object.
Now that you’ve created your three lookup fields, you can choose to filter your lookup field by the other lookup field within the current object. Continuing the examples used above, you can set the Campaign lookup field’s Filter by Field value to filter by the Project Owner lookup field.
By doing this, the campaign records displayed in the Campaign lookup field of each project record (one in the example above) will be filtered by the value of the Project Owner field in the record (two in the example above). Only campaign records with the same Campaign Owner (three in the example above) as the Project Owner in the current record will be provided as options in the Campaign lookup field.
For example, there are 15 campaigns saved in the system. Bob is the campaign owner of three campaigns. If a record’s project owner is set to Bob, the campaign lookup field of this record will display only the three campaigns where Bob is the campaign owner. John is not the campaign owner of any campaigns, so if he is set as the project owner there will be no campaign options.
Related records
By adding a lookup field, you create a one to many relationship between two objects. This means that each record in the “one” object can be related to one record from the “many” object, while each record in the “many” object can be related to multiple records from the “one” object. This is demonstrated above using Campaigns as the “many” object and Projects as the “one” object.
Creating related records
Once you’ve created a relationship between two objects, you can create a new record of the “one” object directly from any record page belonging to the “many” object. Continuing the above example, you can open the June Release campaign page and create a new project record directly from the page. This option will only exist if the record header component is part of your page, to learn more click here.
To create a new record, click the + plus button on the right of the record header and then choose the Project option. This will open a new project form, which you can fill out with any relevant details, such as the name, priority, and more. Note that the Campaign field of this project is automatically filled in with the June Release campaign, which is the campaign we used to create the new project. Once you’ve finished, click Save. This will open the new record you’ve created.
Viewing related records
By using a “many” object’s record page, you can view all the related records. This is done using the Related Multi component, which by default will be found under the record header. However, it’s possible that this component has been moved or removed from your page, to learn how to add it click here.
The related multi component will only appear if there are related records for the current record. For example, if you have the June Release campaign page open, but there are no records related to the June release, this component will not appear. However, as soon as you relate a record to the June release record, you will now be able to see a Projects section within the related multi component. This section will display a clickable icon of the object type, as well as the object’s name followed by parentheses containing the amount of related records related to this object. By clicking on the icon, you’ll open a list view of all these records. For example, if the June release campaign has four project objects related to it, by clicking on the Projects (4) section you’ll open a view with all four of these projects. This view functions and can be edited like any other view; For more details click here.
Related fields
The chosen object of a lookup field is called a related object. By creating a lookup field, the chosen object is automatically set as a related object, and its fields are set as related fields. You’ll now be able to access the related fields within the original object, and can use them in views, summary and formula fields, forms, automations, and more. Each related field displays its value from the record related to the current object.
For example, the Contacts object is related to the Accounts object by default, so all the account fields are related fields of the contacts object. This means that, along with many other helpful options, you can choose to add an account field to a contacts view. To do so, first go to the columns option of a contacts view and then search for the Account field. Now click on the arrow to the right of this field, which will open a list of all the fields in the Accounts object. Now you can click on one of the related fields to add it as a column in your view, such as the Account Owner field. The account owner of the account related to each contact will now be displayed. To learn more about views, click here.
Related To field
The Related To field is a built in lookup field found in the Tasks, Meetings, Activity Logs, and Inbox objects. In addition to the regular lookup field properties explained above, records of these object types will also use the Related To field to appear in the stream of other objects. For example, a task record where the Related To field is set to an account will appear in the stream of this account. In this way, if a task record is related to Danny Gold’s account, the task will appear on Danny Gold’s page in his stream. Additionally, the Related To field will fill in automatically whenever you create a record directly from a stream, so that it’s set to the record you created it from. For example, if you create a new meeting from Alex Brite’s stream, the Related To field of the meeting will automatically be set to Danny Gold. You can learn how to manage your stream here.
There is one difference between the Related To field and any other lookup field. Generally, a lookup field has a set one object which it can relate itself to. For example, the Account lookup field in the contacts object relates each contact to an accounts record. It cannot be used to relate contact records to any other object. The Related To field allows you to choose the object type you’d like to relate the current record to, and then choose the related record. In this way, stream objects can use a single field to relate to all the different objects in the system.
For example, you can create a new task and click the magnifying glass of the Related To field. On the right of the pop up you’ll find a dropdown list of system objects. Here you can select the one object you’d like to relate your task record to, such as an account or ticket. Once you’ve selected an object, you can choose which record within the selected object you’d like to relate the current record to. For example, after selecting the Tickets object from the dropdown menu, you can search for and select any ticket record. Now your newly created task will appear in the selected ticket’s stream.
Object relationships
You can use lookup fields to build relationships between different objects in the system. This allows you to make sure a specific account is related to a specific meeting, a specific campaign is related to a specific project, and much more. There are two types of relationships which may exist between objects, one to many and many to many. Each is explained in detail below.
One to many
A one to many relationship in an object means that there is a single record in one object which has many related records of another object type. A built in example of this is the Contacts object relationship with the Accounts object. Here, each account record can have multiple contact records related to it, but each contact can only have one account. In this way, every contact in the system will belong to a specific account, while each account can have as many contacts as it might need. In the picture below, an account record is displayed, and under the related multi component, which is explained above, you can see all the contacts which are related to this individual account. These types of relationships are built using lookup fields, which are explained in detail at the beginning of this article.
One type of one to many relationships which appear in the system are some of the objects which appear in the stream, such as Tasks, Activity Logs, and Meetings. Each of these objects are the many object in the relationship. They use the lookup field Related To in order to relate to the one object. For example, you can have any type of record, such as a deal, project, or contact, and relate as many task records to it as you’d like. Each task will only be related to one individual record, which will be specified in the Related To field.
Many to many
While one to many relationships are very useful, they don’t work for every type of object relationship. Sometimes objects need to have a many to many relationship, where each record type, on both sides, can be related to multiple other records. For example, an educational institution may need to sign up students for classes. Each student would like to take multiple classes, and each class will have multiple students signed up to it. In order to create this type of relationship, you’ll need to create a helper object. This object serves as the bridge between the two many objects. In this case, you can create a helper object called Enrolled. This object will serve as the single object and the bridge between classes and students. Every enrolled record will have a single student assigned to it, and a single class assigned to it. Each student can have multiple enrolled related records, and each class can also have multiple enrolled related records. To set up this bridge object, simply create lookup fields within the enrolled object for both the class object and the student object. You can find detailed explanations above on how to do this.
As you can see above, by using the enrolled helper object, each student can now be signed up for multiple classes and each class can have multiple students signed up for it. This is only a small example of the many to many relationships you can build in the system. Insurance agencies may use this type of relationship for policies, real estate agencies could use it for listings, and so much more.