sequence of actions

  • 1
  • Question
  • Updated 4 years ago
  • Answered
I have button on a Page Title with a sequence of actions on that begins with "Create new row."
Let's call them A (Create new row), B, C.

On the same model, I have a sequence of actions triggered "When new row created in model." Let's call them 1, 2, 3.


What will the sequence of actions be?

A B C 1 2 3

OR

A 1 2 3 B C
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 48,984 Points 20k badge 2x thumb
I tested this and the answer is A 1 2 3 B C, as long as all of the actions are synchronous --- if any actions are asynchronous (e.g. a Save Models or Re-query Models action), then they may occur later than they would if they are synchronous.

The reason is that all of the Model Actions happen immediately after their triggering event, e.g. when a new row is created, all Model Actions defined on the "When new row is created" event will happen immediately after that occurs. Any subsequent actions in an Action Sequence that included Create new Row would occur later.

Here is the XML for a test page: just click "New Account Test".

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   
   <models>
      <model id="Account" limit="10" query="false" createrowifnonefound="false" sobject="Account">
         <fields>
            <field id="Name"/>
         </fields>
         <conditions/>
         <actions>
            <action>
               <actions>
                  <action type="updateRow" fieldmodel="Account" field="Name" enclosevalueinquotes="true" value="{{{Name}}} 1"/>
                  <action type="updateRow" fieldmodel="Account" field="Name" enclosevalueinquotes="true" value="{{{Name}}} 2"/>
                  <action type="updateRow" fieldmodel="Account" field="Name" enclosevalueinquotes="true" value="{{{Name}}} 3"/>
               </actions>
               <events>
                  <event>row.created</event>
               </events>
            </action>
         </actions>
      </model>
   </models>
   <components>
      <pagetitle model="Account">
         <maintitle>
            <template>{{Model.labelPlural}}</template>
         </maintitle>
         <subtitle>
            <template>Home</template>
         </subtitle>
         <actions>
            <action type="savecancel"/>
         </actions>
      </pagetitle>
      <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="Account" mode="read">
         <fields>
            <field id="Name" allowordering="true"/>
            <field id="CreatedDate" allowordering="true" valuehalign="" type=""/>
         </fields>
         <rowactions>
            <action type="edit"/>
            <action type="delete"/>
         </rowactions>
         <massactions usefirstitemasdefault="true">
            <action type="massupdate"/>
            <action type="massdelete"/>
         </massactions>
         <views>
            <view type="standard"/>
         </views>
         <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true">
            <action type="multi" label="New Account Test" icon="sk-icon-magic">
               <actions>
                  <action type="createRow" model="Account" appendorprepend="prepend" defaultmodefornewitems="edit">
                     <defaults>
                        <default type="fieldvalue" field="Name" enclosevalueinquotes="true" value="Test"/>
                     </defaults>
                  </action>
                  <action type="updateRow" fieldmodel="Account" field="Name" enclosevalueinquotes="true" value="{{{Name}}} B"/>
                  <action type="updateRow" fieldmodel="Account" field="Name" enclosevalueinquotes="true" value="{{{Name}}} C"/>
               </actions>
            </action>
         </actions>
      </skootable>
   </components>
   <resources>
      <labels/>
      <css/>
      <javascript/>
   </resources>
</skuidpage>
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Thanks, Zach! Nice way to perform a quick test.
(Edited)