+ Start a Discussion

creation of visualforce page!


please is there anyone to help me. it s urgent.

so i have 3 objects. A , B , C

  B is the parent of C (master détails relation)

  C have a lookup on A .

I need to show B in the layoutpage of A.

i want a similar code to begin because  i am new into Apex !!

Millions Thanks



Hi MM,


Make a formula field on object A, having formula as objectC__r.objectB.name.


I have tried doing so by having object test1 which is master of test2. and test2 is having lookup on test3.


I think here the formula field will no longer work, a trigger would be beneficial instead.

Create a before inset/update trigger for this.

Let me know if you want me to write code for this.



As you are new to salesforce I am here for you to help you.








As you know whenever there is relation between two objects, parent object layout will have related list of child obj.

Here   B is parent of C ------- so B will have related list of C

And     C is parent of A -------  so C will have related list of A


you want to show B object related list in A object Page layout

as it is not possible to show parent related list on child Object layout.


it is not possible to achive this through standard page layout.


if you want to do achieve this you can do this using VFP and Apex

are you looking for that ..?


hi guys!!

I am very grateful for your help :)

Because am new in Apex and the deadline is tomorrow , please can you give me a similar Apex Code to fininsh my Job.

Millions thanks .


Hey MM,


While writing code for you I anlaysed that in object "C", where you want a field having name of "B" .


We can have a number of records of type "C" on object "A". Because here C is having a lookup on A, there mat be multiple recods of C which are having lookups on the same "A" record. Hence while populating related "B" on "A", which record of "C" should I consider.


It is a bit confusing, let mw know if you are getting this, or I will elaborate more.




hi, i will explain

the object are Mission (A), Cra(B), DetailedCra(C):

In many cases,DetailedCra (C) can have a lookup to Mission(A) -it s not obligatory-.

The case is to display Cra (B) in tha layout page of Mission  if the  DetailedCra(C) record have an look up to Mission(A)

Thank you very much.