master-detail to filter based on record type of parent - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Heather MickeyHeather Mickey 

master-detail to filter based on record type of parent

Scenario:
I have two related objects which have been collecting data for a year. The child object has a master-detail to parent object. It has always been OK that the master-detail returns all values of the master.

Now, it would like to be changed so that the master-detail returns certain values from parent IF the record type of parent is X and certain (other) values from parent IF the record type of parent is Y. How can this be done?

If the above cannot be done on record type of parent but record type of object where the relationship resides (so child), how would that be done?

If the answer is that the master-detail field needs to be retired and two look-ups are used instead, what is the implication of the data collected over the year? Is there any change in object relationship of the field is retired and replaced by look-ups?
Best Answer chosen by Heather Mickey
Heather MickeyHeather Mickey
Solution was found:

Added a field to Object B with picklist values that matched Record Types of Object A.
In the Master-Detail criteria, added logic that stated Object B.Picklist_Field_Value = Object A.RecordTypeName

This allowed the returned results to filter based on the picklist chosen on Object B.

All Answers

Janardhan MuddanaJanardhan Muddana
Hi Heather,
We can do it with define  lookup search filter.
https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_lookup_filters_defining.htm
Sunil SarillaSunil Sarilla
Hi Heather,
Below is my understanding, please let me know if this is correct.
Object A - Master or Parent
Object A has two record types X and Y
Object B - Detail or Child
Curently, some values are rolled up from B to A
Future Requirement: Roll up only certain values from B to A depending on the record type of A?, if so could you let me know what fields need to be rolled up from Child to Parent depending on the record type of Parent?
 
Heather MickeyHeather Mickey
Hi Sunil,

Thank you for your response. I hope the below helps clear up the scenario. I really apprecite your looking into this.

Object A has many records of which each has a field Name and could belong to Record Type X or Y.
Object B has many records of which could belong to Record Type M or N. On both Record Type M and N, the Master-Detail field on Object B is a lookup that shows all values of Object A: Name field.
Currently the maser-detail on Object B returns all values (for both Object B: Record Type M and N) of Object A: Name regardless of Record Type X or Y.

Future need: The master detail on Object B is limited to return only values of Object A: Record Type X, if Object B Record Type is M and return only values of Object A: Record Type Y if Object B Record type is N.

Is this possible to do? If not, what is your recommendation on best way to handle this scenario?
Heather MickeyHeather Mickey

Hi @Sunil Sarilla

Was I able to clarify well? Thank you for your help.

Thank you,

Heather

Heather MickeyHeather Mickey

Hi @Sunil Sarilla (or anyone),

Was I able to clarify the issue? Can anyone help?

Thank you,

Heather

Heather MickeyHeather Mickey
Solution was found:

Added a field to Object B with picklist values that matched Record Types of Object A.
In the Master-Detail criteria, added logic that stated Object B.Picklist_Field_Value = Object A.RecordTypeName

This allowed the returned results to filter based on the picklist chosen on Object B.
This was selected as the best answer