When Model saved action is firing before model is saved.
I have created sample page with one model and one table with two required fields. Tried saving record without populating required field. Of course record got an error for required field being empty. However “When Model saved” is fired.
Here is the Xml of the sample page for this issue.
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
<models>
<model id="Contacts" limit="5" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Contact">
<fields>
<field id="FirstName"/>
<field id="LastName"/>
<field id="Email"/>
<field id="Birthdate"/>
</fields>
<conditions/>
<actions>
<action>
<actions>
<action type="custom" snippet="fireSave"/>
</actions>
<events>
<event>models.saved</event>
</events>
</action>
</actions>
</model>
</models>
<components>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Contacts" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-1FYJ--230">
<fields>
<field id="FirstName" hideable="true" uniqueid="fi-4Qn_3-305" valuehalign="" type=""/>
<field id="LastName" hideable="true" uniqueid="fi-4Qn_3-306" valuehalign="" type=""/>
<field id="Birthdate" hideable="true" uniqueid="fi-4Qn_2-304" valuehalign="" type=""/>
<field id="Email" hideable="true" uniqueid="fi-4Qk_N-293"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="massupdate"/>
<action type="massdelete"/>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
<resources>
<labels/>
<javascript>
<jsitem location="inlinesnippet" name="fireSave" cachelocation="false">var params = argumentse0],
$ = skuid.$;
console.log('fired save...');</jsitem>
</javascript>
<css/>
<actionsequences uniqueid="sk-1FgqD-278"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
Thanks
Gyan