As we all know, Salesforce currently doesn’t natively support filtering related lists but there are definitely some workarounds for that. 200-355 pdf Basically there two ways to show filtered related lists in your standard detail page. One of them is to use Visualforce page and Apex code to filter the related data and add it to the standard detail page by creating a new section. However, we all know that this solution is not truly a related list as we cannot place it in the native related list section. The other workaround that we are going to discuss now doesn’t require any code and we can add it in the native related list section.
Let’s take an example to show Cases with different status in different related list on Contact Detail Page. Each related list should have cases with the specific status (i.e. “New”, “Working” and “Escalated”). The trick is to add three new lookup fields on Case object and reference it to the Contact object. Do not add these fields on any Page Layout. These fields will be used to perform the ‘behind the scene’ magic. Let’s start with creating lookup fields:
Similarly create two more lookup fields for the cases having status as “Working” and “Escalated”. Next, we will use Process Builder to update the values in the new fields. As soon as you will set the values in the new fields, related list in contact will filter the record and will show it in the respective related list.300-320 pdf Whenever you change the status of the Case, the record will move to the respective related list.
We will create three decision nodes, one to check the status as “New”, the other one to check the status as “Working” and the last one is to check the status as “Escalated”. Whenever the record is updated, based on the decision node, we will have an immediate Action to be performed. Based on the decision node, this immediate action will populate the contact value in the new created fields.
Similarly create two more decision nodes and an immediate action with each node to set the lookup field value. See the screens below for the immediate actions:
As you can see in the last three screens, we are setting up the new lookup field values. One will be set as the ‘contact ID’ and other two will be set as ‘null’.
Once all the above steps are done, activate the process and update some of your case records. Make sure you have added the entire new related list on the Contact page layout. You can actually remove the default Case related list from the layout as you now have the new related lists to show filtered records.
Last step is to create a new custom button to create new records. The reason we are creating this new custom button is because the buttons on the new related lists will not populate the related contact ID in the standard Contact ID field.
Once the button is created, add it to the new related lists and uncheck the checkbox for adding standard New button. See the below screenshot for you reference.
You are done! Enjoy the feature!