Corey Babka No Comments

Normally I’ll do 3 tips a month, but this one is a big one so I’m combining all into one big tip actually.  I don’t want to break up the tip into 3, we’ll just spend time here going through the steps.

So here’s the issue; You are a big user of Salesforce’s parent account field but you’re not able to search it at all.  For instance, if I had a parent company “ABC Company” and I wanted to have all the child accounts come up in the global search when I search for “ABC”, I have an issue as lookup fields are not available for global search.  Beautiful tool, but no access to the lookups like the parent account field (incidentally, what we do below would work for any lookup field).  So what we’ll do is create a searchable field, use the process builder to populate that field, then use another process to manually update that field.

Create the search field and checkbox

First things first, we have to go to the setup and add in two new fields to the account form.  We’re going to add a field called “Parent Account (for search)” and a checkbox called “Update Parent Search” with normal field processes.  I don’t need to go through the whole process here, I think you know how to add in a field or two at this point (if not, see our other blog posts).  Just a checkbox and a text field (make the field plenty long as lookups don’t really have a size limit…. that I know of).  I’ll throw these fields way down low, in the system area to not take up decent real estate.

Create the process(es)

Now that we’ve got those, now we have to get a process to update the new text field with the parent account field name when it changes (and isn’t blank).  We’re going to go to Setup, search for “Process”, then click on the 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 created.

Save it.

Next screen, add your criteria.  There’s a few ways to do this, but I try to keep it simple.  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).

Save it.  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.  It will allow you to create other criteria if you like to really whittle it down, but I did that in the previous page so I’ll just update.

What I did above was update the parent account search field with the company name from the lookup (that’s why the reference).  Activate the process and we’re done.

Now the bad news here is what we did was for all new and changed records.  What do we do with old ones?  Well, we’re going to do a similar process here and just do when the checkbox changes to yes.  We’ll also update the checkbox to no right away after that, so that it’s more of a tool to update things.

Go through the motions as above, new process, name it, etc.  Change on the checkbox though will force it to work no matter if it changes or not and will just overwrite (this is for the older stuff).

Activate it and now we’ve got something for the old records as well.

Create/Edit the views and your search layouts

So at this point our global search should be working if it’s filled in.  However, for ease, we’ll add “Parent Account” to the search layouts.

Go to Setup, search for “layout”, then select “search layouts” under the account area.  Edit the “Search Results” set of fields and add in the parent account.  While this is not the field searched, it allows the users to see it.

Now, to clean up those pesky old accounts, create a view where the parent account search is empty and the parent account is NOT.  Then add in that checkbox 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.

For this last part a lot of folks will just do a mass update on data loader but this is a little kinder in my world.

Leave a Reply

Your email address will not be published. Required fields are marked *