0

In the Salesforce accounts object, there is an issue with the associated organizations being displayed. Currently, when a new associated organization is added to an account, regardless of whether or not the associated organization is marked as active or inactive, it is being displayed in the corresponding field on the Accounts details page for the organization (not the associated org).

In this field, only active associations should be displayed. In order to ensure this, I was initially thinking that I could put a trigger on the object itself to run a class method when an association is added to it, but it seems like this could only really be used to look through each of the associations after a new one is created, check if it is inactive, and if so, remove it as an association.

The issue with this approach is that it would cause the entire association to be delete when the requirement here is only that inactive associations not be displayed on the organization page.

How can inactive associations be prevented from being displayed?

1
  • Can you post a picture for better understanding Commented Apr 3, 2018 at 21:57

1 Answer 1

2

It sounds like what you want is a filtered related list. There are two primary ways to achieve this, unless and until it's promoted to a feature within the platform.

A programmatic approach is to write a Visualforce page or Lightning component to be embedded within the page layout. This component would query for related objects and perform filtration in Apex before displaying the items on the page. It's a high-cost solution and I at least find the user experience in Visualforce lacking, as it doesn't allow for a "standard" looking related list.

The other is to use declarative automation (Process Builder) to populate a second lookup on the child object to the Account based upon criteria. This creates a second related list whose contents are controlled by when the Process populates the lookup field; the second related list can be added to the page layout and the original removed to achieve a full native in appearance filtered list. Doug Ayers has a much better write-up of this technique than this, which I highly recommend.

1
  • Thanks. I was actually trying to filter the associated accounts before they are added to the list. I actually found the trigger that was creating the list and was able to edit it. Commented Apr 4, 2018 at 22:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .