function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jcohanallroundsjcohanallrounds 

How to create 'filtered' sections in Master Detail relationship

If I have a master object called  Vehicles and and a child object called VehicleType with RecordType = {Car, Bike}, how can I show both types of record types results in the layout of the master? 

 

In this case some of the fields in Car do not apply to Bike so I would want to show the records related to Cars for the corresponding RecordType and different fields for Bike in its recordType layout.  I have only been able to show one generic layout but many of the fields of Car would not apply to Bikes. (see below)

 

Vehicles (Master)

---------------

Total Number of Vehicles:  2

 

Car (VehicleType object , recordType = 'Car')

---------------------------------

 Acura     4 wheels     Rotary Engine     4 Doors      1 trunk

 

 

Bike (VehicleType object, recordType = 'Bike')

-----------------------------------------

Bianchi     2 wheels      

Best Answer chosen by Admin (Salesforce Developers) 
CloudForwardCloudForward

JC - have you tried customizing the page layout of the master object to show the related lists of the child?

 

That should do it.  I don't think you need custom code for this.  You can see all the child objects of different record types on the master object page in related lists.  When you are in the page layout, just customize the related list section to show the fields you want to see.  Give a call if you have trouble getting this to work.

 

Best regards,

All Answers

dmsx2oddmsx2od

Use two page layouts and assign each of them to a record type.  This is exactly the primary purpose of using record types.

Consult the Salesforce help section for guidance.

jcohanallroundsjcohanallrounds
Thanks for the response.  I actually need to have the results on the same page.  I learned I am able to accomplish this by extending the standard controller, grabbing the records related to Bike, grabbing the records related to Car, and displaying those results in an Visualforce call.
CloudForwardCloudForward

JC - have you tried customizing the page layout of the master object to show the related lists of the child?

 

That should do it.  I don't think you need custom code for this.  You can see all the child objects of different record types on the master object page in related lists.  When you are in the page layout, just customize the related list section to show the fields you want to see.  Give a call if you have trouble getting this to work.

 

Best regards,

This was selected as the best answer
dmsx2oddmsx2od

Alan raises a good point when talking about related lists.  Could you please explain your requirements again?  You want to look at the parent object and see information from the child objects?  In that case, you should edit the related lists.

If you only want to see child1 on recordtype1 and child2 on recordtype2, then you'll need to create a page layout on the parent for EACH record type, and to edit the related lists accordingly.

 

Could you please restate the requirements if I'm not understanding them completely.

jcohanallroundsjcohanallrounds
I got it to work and it is doing the right thing.  Thanks.