You need to sign in to do that
Don't have an account?
Luciano Roberto
Visualforce to create record child
Hi Folks,
I have two objects:
ParentObject__c (Parent record)
ChildObjetc__c (Child Record)
The relationship between them is master-detail.
I need to create a visualforce page to be able to create a child record, that is, when accessing the details of the parent record, have a custom button that will call the visualforcepage to be able to create a child record, with the parent record id.
Does anyone have any idea code to help me?
If you just want to create child record from parent detail page, I would suggest you to use quick actions instead of a custom button and visualforce page, unless you have some other requirements to go with custom page solution which you have not stated here.
Follow below steps to achieve this:
- Go to parent object from object manager and click on " Buttons Links and Actions" Link.
- Then create a new action with action type = "Create a new record". Select target object as your child object and then define other properties.
- Then select the fields of child object that you want on the record creation page. Click save.
- Go to the page layout of parent object and add the newly created action to quick actions bar.
Please like and mark resolved if this helps.All Answers
If you just want to create child record from parent detail page, I would suggest you to use quick actions instead of a custom button and visualforce page, unless you have some other requirements to go with custom page solution which you have not stated here.
Follow below steps to achieve this:
- Go to parent object from object manager and click on " Buttons Links and Actions" Link.
- Then create a new action with action type = "Create a new record". Select target object as your child object and then define other properties.
- Then select the fields of child object that you want on the record creation page. Click save.
- Go to the page layout of parent object and add the newly created action to quick actions bar.
Please like and mark resolved if this helps.My problem was more or less in this context that you mentioned. I managed to resolve by following his steps.
Thank you very much.