You need to sign in to do that
Don't have an account?
daniel.duarte
Record Types and Master-Detail Relationship
Hello,
Does the Record Type of my custom object affect the objects that are a detail of this object in a master-detail relationship?
For example, I have a ParentObject__c and a ChildObject__c, and in the child object I create a custom master-detail relationship field that references the parent object. Then, I create different record types for the parent object. Can I display different page layouts for the child object according to its parent type?
Another question: can I have a custom field that is required for one record type but not required for another?
Thanks
You can have page layouts corresponding to your different record types, and then on page layout for the record type which requires the field to be mandatory, you can set the page layout level required checkbox on the field.
All Answers
You can have page layouts corresponding to your different record types, and then on page layout for the record type which requires the field to be mandatory, you can set the page layout level required checkbox on the field.
Thanks.
I needed to display different page layouts at the moment that I create the record, depending on the parent's type. So I won´t be able to do this using record types, correct? I will have to customize the creation/edition page for the record and show or hide specif fields depending on the parent record type.
Can I do something like automatically set the record type for the child record before inserting it? Is there anyway to show a different page for new records avoiding apex code and using SF standard resources, like Record Types or something similar?
Have a formula field on the parent called ChildRecordType, which is populated with the desired ChildRecordTypeid based on the parent record type, add this to the layout,
Create a custom button on the child object to override the default new button. Grab the default new button URL and set as the URL of this button. Save for replace the recordtype=Xxxxx part with the formula field we created above. Sort of like URL rewriting/ screen scraping . Set to recordtype={!ChildRecordTypeId} in the URL.
Add this button in the related list in the parent page layout. Needless to say this will work only when child records are created from the parent screen. You might want to hide the child tab to prevent creation via the default route.
Then there is always an apex trigger. You could have a before insert trigger on the child which sets the appropriate record type based on the parent record type,
I am using different layout configuration, with different required fields in each. The only inconvenient is that the user has to choose which record type does he want before showing the creation page. I was trying to find an easy way to avoid it using master-detail relationship, defining the record type according to the master.