function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BryanTSCBryanTSC 

Creating Parent & Multiple Child Records in One Step

I am looking to create a Visualforce page that will serve as a data collection form on our website.  The user will ultimately be creating a contact record (linked to an existing account via a lookup) and then several child records (inquiry history, extra curricular interests, family relationships, etc.)  I would like the user to have the ability to create more than one of any of these child records during this process.

 

Visual:

 

Contact (1)
--Inquiry History (1)
--Extra Curricular Interests (Many)
--Family Relationships (Many)
--Test Scores (Many)

 

1)  Is this feasible?

2) What technique is best suited for this type of action?

 

mtbclimbermtbclimber

Yes, this is feasible.

 

Not sure what you are looking for with your second question.  Perhaps you can elaborate on your constraints if known.

BryanTSCBryanTSC

Thanks!

 

I've seen some setups that utilize pageblocks with "add row" and "remove row" buttons.  Is this the most efficient way to do this?  Does this still apply if you are creating the parent record in the same step?  I'm more or less looking for a quick play by play on what the best way to tackle this is before I spend a bunch of time on it and get nowhere.

Laytro80Laytro80

Hi,

 

Trying to do the same thing more or less, did you get anywhere with it?

 

Thanks

BryanTSCBryanTSC

No such luck yet :-(

Laytro80Laytro80

Will let you know how I go.   I have an expense form (master object) and expense item (child object).  I want to use a VF page and APEX controller to create a wizard that lets you create the expense form and as many expense items as you want all in one go.  When you hit save the master detail relationship will roll-up the numbers.  But finding it tough to write the controller and then render the page.

DRobi83DRobi83

Im interested in this. I cannot find a good example of how to add/remove child records from the parent visualforce page layout (invoice line items on an invoice)

MoosecoutureMoosecouture

Sounds very similar to what I am trying to work on.  Has anybody found a solution to this? 

 

I am looking to create a Case (Parent) and Items__c (Child) on the same page using a Wrapper.  The Case (Parent) will not have already had information Populated since it is being created at the same time as Item__c (Child).  Most of the Inserting Multi-Child Wrappers that are out there are for the purpose of after the Parent has been created.  I am seeing that there needs to be an insertion of the Parent before the Child from my research but I am unsure of how to execute this through code. 

 

I was using a Code that was posted on here called OrderEntry with a few alterations in order to make it work but Management told me that they want it so that the Item__c (Child) is being Posted at the same time as the Case (Parent) is being Created.

 

I really would love to solve this Solution.  If you are wondering about where to find the Basic Remove Add Row OrderEntry Code Here it is:

 

http://boards.developerforce.com/t5/Visualforce-Development/Passing-parent-id-to-child-record-in-VisualForce-page/m-p/111177#M9732

 

Also through further research I would love to implement something more a long the lines of Bob Buzzards AccountWrapper:

 

http://bobbuzzard.blogspot.com/2011/07/managing-list-of-new-records-in.html

 

This seems to work better as it allows you to bulk add rows rather than just one at a time and also allows you to be able to delete any of the accounts even if they are in the middle.  Seems like a serious time saver in my opinion would love to resolve this if anybody did have a solution.

nyanginyangi

Did you get an answer to Creating New Parent Record simulteniously with multiple child records?

MoosecoutureMoosecouture
No,

I actually tend to believe that nobody bothers to ever listen to any of my questions pretty much every question I ever post never gets a response.

Craig
nyanginyangi

Been scratching my head for days trying to figure out how this can be implemented. What was your Option B?

BryanTSCBryanTSC

Yes - I do have the answer to this question!  What is the particular case that you are trying to solve?!

nyanginyangi

I have 2 Objects, Request for Expenditure (Parent) and Expense Line Item (Child). A user should be able to associate multiple Expense Line Items to a Request for Expenditure. On clicking "Save" , multiple Expense Items associated with the Request for Expenditure record should be created without necessarily having an existing Request for Expenditure (parent) record. 

 

Kindly assist

nyanginyangi

To over-emphasise. You do NOT originally have a Parent ID. A Parent Record and Child records are being created simulteniously. 

BryanTSCBryanTSC
I will send you an example shortly.
nyanginyangi

Thanks Bryan. Will be waiting.

Samantha PowellSamantha Powell
Hi Brian, I know this is an old post, but would you be able to share an example of your solution? I've been stuck on this same problem for a few days now and haven't been able to fully resolve it with the Bob Buzzard Managing a list of New Records in Visualforce blog post. Thank you for any help you can provide!
Hoan Hoang 8Hoan Hoang 8
I am looking for a solution. Can someone help? Thanks a lot!