+ Start a Discussion
Jacob W LandisJacob W Landis 

How to make one dynamic edit page for all children


We have one master object which has 6 master-detail children objects. As I know there is no way to make master-detail field read only in creating new children page. So I want to code my own dynamic page which can be used for all children objects.  My plan is
1. Create a vf page, this page has to be dynamic generated, based on which object be passed in parameter.
2. create a custom button for every children object and pass the parentid and children object name to this vf page.

Is this possible? is there any sample code that I could reference?
sharathchandra thukkanisharathchandra thukkani
Can you explain what do you mean by this statement ? 'As I know there is no way to make master-detail field read only in creating new children page.'

Any Wayz You can you Schema methods and generate the VF page with the fields present in that object.(Every thing is Dynamic)
Jacob W LandisJacob W Landis
In the parent object detail page, you can see the related list for childrens, when you click new button for the children, The master-detail field can only be shown as editable in the edit page for creating new children. But we want to make it read-only,  not editable, since it should be the parent shown earlier.
Andreas Wolf 3Andreas Wolf 3
Hi Jingli,
Why not create six pages with six own controllers, that might be a bit much for nearly the same but if something goes wrong it is way more maintainable than to put all in one big class.Also you can then simply override the NEW button on each sibling with its own related VF page

For displaying the master-detail on the page I would use a custom filed ( custom link ) and not putting the master detail onto the layout at all
so you don't need to mess around with it