Performing a Salesforce global search on lookups tends to yield you no results. Read on for a some tips on how you can accomplish this.
Why Does A Salesforce Global Search on Lookups Not Work?
If you are a user of parent account field in Salesforce you may have noticed you cannot search it at all. For instance, if if you wanted to search on parent company “ABC Company” and have all the child accounts come up in the global search when you search for “ABC”, you will have an issue since lookup fields are not available for global search in Salesforce.
Luckily, with some customizations you can accomplish this type of search.
How Do I Create A Searchable Lookup Field?
We can still accomplish this but it requires creating a searchable field, setting up an automated process to populate the field and then another process to manually update the field. We will use the above example to outline the process.
Part 1 – Create the fields
- Go to Setup, Object Manager and Choose Accounts.
- Choose Field and Relationships on the left and then click New.
- Choose the Text field and click next. Name the field “Parent Account (for search) and click Save. Choose the visibility and layouts accordingly.
- Repeat step 3 and create a checkbox field called “Update Parent Search”
- If the fields do not appear in the account layout you can add them wherever you would like.
Part 2 – Create the processes – here is created using Process Builder but you can use Flow Builder as well.
- Go to Setup and type “process” and select Process Builder
- This will open up the process builder where we want to make a new process. Let’s call it “Update Parent Search Field”. Start the process when the record changes.
- Click “Add Object” to choose the object (account), when the record is edited or and created and click save
- Next screen, add your criteria. Name the criteria (for reference), then make the changes. Here I’m comparing the parent account id (the actual data pulled back from the lookup) and making sure it isn’t null and it’s changed (be careful of the true/false on the right) and click save.
- Now create the immediate actions. Click on that, then name it, choose the “update records” function, select the current record, then update the field you want with a formula.
- Activate the process.
The above is now good for all new and changed records. A second process now needs to be created for the older accounts that will not be changed. This process will involve the checkbox field created above.
Go through the same process as above with the new process, name it, etc.
Once the checkbox process is in place, you can create a view where the parent account search is empty and the parent account is NOT. It will make sense to add in the checkbox field as a column.
Once this view is active, you can actually update or check that box from the view (multiple records), which will force the update of the field. Once their all done, remove the check box field, remove the views.
Please contact us at email@example.com for any Salesforce questions or support you need. Feel free to comment below. We’d love to hear your thoughts!