0

Is it possible to show records two level deep in the related lists? Mentioned below is the scenario:

Object A has a self lookup and is a parent for Object B.

In the Related list of Object A, if B has a lookup to A, we would see record B in the related list of object A. However, for the self lookup, we would not see the record B in the related list(i.e. we would not see Record B in the related list of parent of A).

Is it possible to show all child records of A in related list of parent of A?

0

We can have two workaround for this scenario: We can customize the button(which creates the child record) to autofill a Lookup named Parent Account(which will have the Parent Account of Master Account). Say you have two Accounts A1 & A2 and Object B1. A1 is the parent of A2 and A2 is the parent of B2. So, when you create B2 you should fill A1(gettign from from A2). This way you can get the records in the same related list.

Secondly you can write a vf page with a controller and query all Object B where A2.Parent =: A1.id or CurrentPageid

String CurPgID = ApexPages.currentPage().getParameters().get('id');
lstObjB = [SELECT id, name, A2 FROM ObbjectB WHERE A2.Parent =: CurPgID];

This way you can get your desired results in the list, which you can display as a vf page block in the standard page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.