You need to sign in to do that
Don't have an account?

Create multiple child records from parent button
Hi,
I could really use some guidence on a current problem I'm faced. Any help would be much appreciated.
I have 2 custom objects with a master detail relationship: parent__c and child__c.
A Parent__c record contains information for 4 payments. Chilld__c will be the recipt for each individual payment.
What I want is for a user to be able to press a button on the parent and create 4 new child records. Each child record will be a recipt for one of the 4 payments.
Can anyone tell me how this can be achieved?
So far I've seen similar examples using Apex, Flows, Custom Controllers, VF pages and more. All of them are fine, I just don't know which would be most appropriate.
Thanks in advance.
I could really use some guidence on a current problem I'm faced. Any help would be much appreciated.
I have 2 custom objects with a master detail relationship: parent__c and child__c.
A Parent__c record contains information for 4 payments. Chilld__c will be the recipt for each individual payment.
What I want is for a user to be able to press a button on the parent and create 4 new child records. Each child record will be a recipt for one of the 4 payments.
Can anyone tell me how this can be achieved?
So far I've seen similar examples using Apex, Flows, Custom Controllers, VF pages and more. All of them are fine, I just don't know which would be most appropriate.
Thanks in advance.
The most appropriate approach is to create a visualforce page with standard controller as parent__c and add a controller extension class which performs your operation of creating 4 child__c records. Then, create a custom button with this visualforce page as the content. Here is an example of the extension: http://salesforce.stackexchange.com/questions/27360/create-a-button-in-vf-page-that-creates-a-new-case-with-certain-record-type
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank
All Answers
The most appropriate approach is to create a visualforce page with standard controller as parent__c and add a controller extension class which performs your operation of creating 4 child__c records. Then, create a custom button with this visualforce page as the content. Here is an example of the extension: http://salesforce.stackexchange.com/questions/27360/create-a-button-in-vf-page-that-creates-a-new-case-with-certain-record-type
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank
You can write an apex class and create 4 child record in this class. Create a custom button on parent object with created apex class.
Thanks for your help with this. Much appreciated.