Wizard button does not display error messages when multi-action with multiple model save

Hello -

When a wizard button is marked as “run multiple actions” and one of the steps is “Save Models” and if there is more than one model selected to be saved, error messages are not displaying. If only one model is selected for save, error message display properly.

Analysis
In wizard.step.button case “multi”, step.editor.models.length = 0 when multiple models are involved but when only a single model is involved, step.editor.models.length = 1.

Steps to Reproduce

  1. Create Account “new” page
  2. Remove all default components
  3. Change model name of Account to “AccountOne”
  4. Add another account model (don’t load, create new, add Name & Id) called “AccountTwo”
  5. Add wizard with single step
  6. Add two fields editors with single field for “Name” using AccountOne and AccountTwo
  7. Add wizard button - Run Multiple, Save Models including AccountOne and AccountTwo
  8. Preview page
  9. Click wizard button

Actual Result
Save does not occur but no error messages

Expected Result
Save does not occur and error messages are displayed

Notes:

  1. The sample page contains two wizards - One as described above and the other configured identical but with “save models” only specifying a single model. Pressing the button on this wizard properly displays error messages
  2. If another button is added to the wizard that saves multiple models and that button contains only a single model to save (or uses the standard save instead of run multi), error messages are displayed when clicking the button added in Step #6. This appears to be due to the fact that step.editor.models.length = 1 due to the 2nd button
  3. A couple of posts that might be related
    a) https://community.skuid.com/t/standard-error-messages-are-not-displaying-when-data-mod… - This one solved the problem by using stock “save” but that is not an option in my case unfortunately. Need to be able to run multi.
    b) https://community.skuid.com/t/not-able-to-see-required-field-error-message-when-clicki…, - This one appears similar but never had a solution.

Sample Page XML

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="AccountOne" limit="1" query="false" createrowifnonefound="true" sobject="Account">
         <fields>
            <field id="Id"/>
            <field id="Name"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="AccountTwo" limit="1" query="false" createrowifnonefound="true" sobject="Account">
         <fields>
            <field id="Id"/>
            <field id="Name"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
      <model id="AccountThree" limit="1" query="false" createrowifnonefound="true" sobject="Account">
         <fields>
            <field id="Id"/>
            <field id="Name"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
   </models>
   <components>
      <wizard deferstepcontentsrendering="false">
         <steps>
            <step stepid="step1" steplabel="Step 1">
               <components>
                  <basicfieldeditor showsavecancel="false" showheader="true" model="AccountOne" mode="edit" buttonposition="" layout="">
                     <columns>
                        <column width="100%">
                           <sections>
                              <section title="Basics">
                                 <fields>
                                    <field id="Name"/>
                                 </fields>
                              </section>
                           </sections>
                        </column>
                     </columns>
                  </basicfieldeditor>
                  <basicfieldeditor showsavecancel="false" showheader="true" model="AccountTwo" mode="edit" buttonposition="" layout="">
                     <columns>
                        <column width="100%">
                           <sections>
                              <section title="Basics">
                                 <fields>
                                    <field id="Name"/>
                                 </fields>
                              </section>
                           </sections>
                        </column>
                     </columns>
                  </basicfieldeditor>
               </components>
               <actions>
                  <action type="multi" label="Save Account One &amp;amp; Two" stepid="step1" window="self">
                     <actions>
                        <action type="blockUI" message="Saving..."/>
                        <action type="save" rollbackonanyerror="true">
                           <models>
                              <model>AccountOne</model>
                              <model>AccountTwo</model>
                           </models>
                           <onerroractions>
                              <action type="blockUI" message="There was an error" timeout="3000"/>
                           </onerroractions>
                        </action>
                        <action type="unblockUI"/>
                     </actions>
                  </action>
               </actions>
            </step>
         </steps>
      </wizard>
      <wizard deferstepcontentsrendering="false">
         <steps>
            <step stepid="step1" steplabel="Step 1">
               <components>
                  <basicfieldeditor showsavecancel="false" showheader="true" model="AccountThree" mode="edit" buttonposition="" layout="">
                     <columns>
                        <column width="100%">
                           <sections>
                              <section title="Basics">
                                 <fields>
                                    <field id="Name"/>
                                 </fields>
                              </section>
                           </sections>
                        </column>
                     </columns>
                  </basicfieldeditor>
               </components>
               <actions>
                  <action type="multi" label="Save Account Three" stepid="step1" window="self">
                     <actions>
                        <action type="blockUI" message="Saving..."/>
                        <action type="save" rollbackonanyerror="true">
                           <models>
                              <model>AccountThree</model>
                           </models>
                           <onerroractions>
                              <action type="blockUI" message="There was an error" timeout="3000"/>
                           </onerroractions>
                        </action>
                        <action type="unblockUI"/>
                     </actions>
                  </action>
               </actions>
            </step>
         </steps>
      </wizard>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>

Thanks!

In our next release, save actions called from wizard title areas will correctly send users down the error path if the save fails.  I believe this will be fixed. 

Thanks Rob.  In this case, the save does end up going down the error path, it’s just the error messages aren’t displayed when multiple-models are involved.

It looks like with the next release,  if you parse your save actions into individual actions (rather than grouping multiple saves together),  then the specific error messages associated with the model save failure will be displayed.  Again this perhaps not optimal,  but I believe it will accomplish what you are looking for. 

Hey Rob - Unfortunately, this won’t achieve the desired result since we need an “allOrNone” outcome.  Currently, individual saves with only a single model properly go to error path and display messages.  However, individual saves with multiple models go to error path but don’t display messages.  Couple of questions:

1) You mentioned “this will be fixed” - Can you provide more details about what is being fixed?  In the single model scenarios, at least in my test cases, everything works as expected in the current release.

2) Regarding multiple models being involved, is this something that will be addressed at some point?

Thanks!

Hey Rob - Just tested this in Banzai RC5 and even with multiple models, the error path is taken so we’re good there.  Can you shed some light on #2 about improving the error message display and if this will be addressed at some point?  In our case, we need an “allOrNone” so breaking up the saves isn’t possible.  Without error messages, the user is left to “guess” at what might be wrong.  Thanks!