Wizard Component - Create Multiple Child Records

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
Working with the Wizard component ... stepping the user through a series of questions that will first create a parent record then 1 to many child records all related to the parent object. Once a child record is created I am prompting the user "Create another child record?". If yes then I go back to a previous step in the wizard and the user enter information for another child record. 

I have the creation of the parent record working.  I have creation of the first child record working and it is related to the record.  However, can't figure out how to create another child record. When I display the step in the wizard to create a new child record I am seeing the child that was just created. 

Any ideas?
Photo of ksumner


  • 120 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 45,308 Points 20k badge 2x thumb
That's a great wizard use case.  But these things get really complicated....

This is what I think needs to happen:

On Create another child record run the following action sequence. 

1. Save parent
2. Save child 1
3. Empty rows on the child model
4. Create new row on child model.   I think the condition will pre-populate the data with the right parent ID.  You'll want to check this tho. 
5. Go back to the child definition step of the wizard. 

I think that should do what you are looking for. 
Photo of Kaede Holland

Kaede Holland

  • 3,176 Points 3k badge 2x thumb
Sorry to resurface this one - but I'm trying to do something kind of similar. I want to use a wizard to:

Step 1: create a parent record (expense report) and then move on to
Step 2: a table that allows the user to create child records (expense line items). I don't have a ton of experience with action sequences - so I'm a little stumped on how to get started. Are there any tutorials or other posts with explanations or xml I could copy and use as a reference?
Photo of Bill McCullough

Bill McCullough, Champion

  • 13,822 Points 10k badge 2x thumb

I don't think you need to use the action sequence.  Just make sure to set a condition on your expense report lookup field on your expense line item record to the Id of the model of your expense report.  Skuid will take care of setting the right 'Id' when you save the expense line item model.

Here is an example page that shows this.  You can create a 'parent' account and 'child' contacts.  It uses a 2 step wizard.  As an alternative, you can also have a single page that shows the expense report fields at the top and a table to allow entry of child expense line items.



<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Account">
        <model id="Account" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Account">
                <field id="Name"/>
                <field id="Id"/>
        <model limit="20" query="false" createrowifnonefound="true" datasource="salesforce" id="Contact" sobject="Contact">
                <field id="RecordTypeId"/>
                <field id="FirstName"/>
                <field id="LastName"/>
                <condition type="modelmerge" value="" field="AccountId" fieldtargetobjects="Account" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
        <wizard deferstepcontentsrendering="false" buttonslocation="top" uniqueid="sk-3xJWeA-238">
                <step stepid="step1" steplabel="Step 1">
                        <basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="edit" uniqueid="sk-3xJUwd-212">
                                <column width="100%">
                                        <section title="Basics">
                                                <field id="Name" uniqueid="sk-3xJUwQ-207"/>
                        <action uniqueid="sk-3xJWe9-235" type="navigate" stepid="step2" label="Next Step" icon="sk-icon-arrow-right" window="self"/>
                <step stepid="step2" steplabel="Step 2">
                        <skootable showconditions="true" showsavecancel="false" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Contact" buttonposition="" mode="edit" allowcolumnreordering="true" responsive="true" uniqueid="sk-3xJtPM-382">
                                <field id="FirstName" hideable="true" uniqueid="fi-3xKHut-604"/>
                                <field id="LastName" hideable="true" uniqueid="fi-3xKHuu-605"/>
                                <action type="edit"/>
                                <action type="delete"/>
                            <massactions usefirstitemasdefault="true">
                                <action type="massupdate"/>
                                <action type="massdelete"/>
                                <view type="standard"/>
                        <action uniqueid="sk-3xJWeA-236" type="navigate" stepid="step1" label="Previous Step" icon="sk-icon-arrow-left" secondary="true"/>
                        <action uniqueid="sk-3xJWeA-237" type="multi" icon="sk-icon-save" window="self" label="Save">
                                <action type="save">
                                <action type="redirect" window="self" url="/{{{$Model.Account.data.0.Id}}}"/>
        <actionsequences uniqueid="sk-3xJhhv-324"/>
        <styleitem type="background" bgtype="none"/>
Photo of Kaede Holland

Kaede Holland

  • 3,176 Points 3k badge 2x thumb
This is perfect - so helpful. Thank you!!!