How to add and filter data through Lookup fields in XRL
Learn to leverage look up fields to enhance data quality in Salesforce Views
Introduction
In Salesforce, look-up fields are used to establish relationships between two objects. They enable records in one object to refer to records in another object. When you create a lookup field, you are essentially relating the field's values to another object (e.g., a table). Lookup fields can also use filters to drill down on specific data to display in the picklist, or they can be based on another field's value, or a combination of the two.
Look-up fields can be configured to display specific fields from related records and can be sorted and filtered as any other table can.
In this article, you will understand how to:
- Configure lookup fields
- Apply server-side filters for lookup fields
- Edit lookup fields
Tip: Refer to the link to know more about lookup fields in the Salesforce. |
Which type of user can perform the configuration of lookup fields?
Procedure
Configure Lookup Fields
Once the admin has configured the Orenda Grids XRL, you (the standard or power user) can configure lookup fields. We will work with the Cases XRL example to walk you through the steps
Step 1: Click on the settings dropdown on the right and click on Configure option.
Step 2: The configuration wizard is displayed. On the left sidebar, you will see a list of all the configurable fields for the Cases Related List. Select any field you want to see in the Related List view and it will be visible under the Selected Fields section.
Step 3: You can select fields from the Selected Fields section which will appear on the grid. Fields with a “>” sign indicate a lookup field. Click on the lookup fields to open the objects field list. You can add up to 20 fields in a Related List view by clicking on them as needed.
Step 4: To change the sequence of the fields in the Related List view, simply drag and drop the field at the correct place.
Step 5: If you selected the wrong field in the view, click on the Delete icon next to the field name to remove it.
Apply Conditions
As the name suggests, these records are fetched directly from the database depending upon the SOQL query that a user can build through an easy-to-use query builder.
We will work with Cases XRL examples to walk you through the steps to apply server-side filters to lookup fields using XRL.
Step 1: On the Configuration Wizard, click on the Apply Conditions in the Field Selection tab.
Step 2: Select up to 5 levels of lookup fields from the Available Fields section, to which you need to apply a server-side filter.
Step 3: Filter Criteria
Choose the appropriate filtering criteria. A variety of operations are available and are displayed depending on the type of Available fields such as "contains", "equals", "is not empty," and more.
- Is equal: This filter displays the records with data that exactly matches the filter value
- Is not equal: This filter displays the records with data that does not exactly match the filter value
- Begins with: This filter displays the records with data that begins with the specified value
- Does not begin with: This filter displays the records with data that does not begin with the specified filter value
- Ends with: This filter displays the records with data that ends with the filter value
- Does not end with: This filter displays the records with data that does not end with the filter value
- Contains: This filter displays the records with data that contains the exact filter value
- Does not contain: This filter displays the records with data that does not contain the exact filter value
- Greater than: This filter displays the records with a value greater than the filter value
- Greater or equal: This filter displays the records with a value greater than or equal to the filter value
- Less than: This filter displays the records with a value lesser than the filter value
- Less or equal: This filter displays the records with a value less than or equal to the filter value
- Range: This filter displays the records with a value within a specified range
- Is empty: This filter displays the records which contain no data in the specific field and leaves out the records which have any value corresponding to the field.
- Is not empty: This filter displays only those records which contain any value for the mentioned field, leaving out all the records where the corresponding field is empty.
Step 4: Applied Conditions
- Once you choose an appropriate filter option and click on Add Condition it is added to the list of Applied Conditions. These conditions will be applied when loading the grid.
- If you want to Edit any of the Applied Conditions, under the Actions field, click on the Edit button.
- If you want to Delete any of the Applied Conditions, under the Actions field, click on the Delete button.
Step 5: Condition Filtering Pattern
Construct different logical connections among conditions using parenthesis and the words ‘AND ‘OR’. By modifying the parentheses' or logical operators' order, you can adjust the Boolean logic as necessary. By default, if we apply multiple server-side filters, these work on AND logic. For instance, in above example, the filter on Case Priority and Product Code have AND logical connections between them, thus will result in a view having low priority and having digit ‘12’ in its product code.
Step 6: You can apply filters to any other field as necessary, even to the fields not configured to display in the Related List view. Click Save to modify the current Related List view. In case, you need to have a separate view, click “Save As”.
Edit Lookup Fields
Once you have configured the lookup fields, you can edit them. You will also understand how only one level of lookup fields can be edited. Inline editing must be enabled by the power user using the Field Settings in the configuration wizard. We will work with the Cases XRL example to walk you through the steps.
Step 1: Click on the settings dropdown on the right and click on Configure option.
Step 2: The configuration wizard is displayed. Click on the Fields Settings tab. Under the Fields Selection drop-down, select the lookup fields for which you want to enable the inline editing. In the given example, i.e., Account Source field is a lookup field.
Step 3: Scroll down the window and select the checkbox Is Column Editable. Because inline editing can only update the value of the current record, it is limited to one level of lookup fields. When there are multiple levels of lookup fields, updating the current record may affect the values of multiple related records, causing data consistency issues. As a result, Orenda Grids XRL only allows inline editing for one level of lookup fields in order to maintain data integrity and avoid cascading updates that can result in unintended consequences.
Step 4: Click Save. Now, the standard user can edit the values as required.
Result
From the above procedure, a user can configure the Related List view with lookup fields and edit the associated lookup field for a specific record.