"When Model saved" action firing before model is saved

  • 1
  • Problem
  • Updated 9 months ago
  • Solved
  • (Edited)
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 = arguments[0],
$ = skuid.$;
console.log('fired save...');</jsitem>
        </javascript>
        <css/>
        <actionsequences uniqueid="sk-1FgqD-278"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>


Thanks
Gyan
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb

Posted 12 months ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Thank you for bringing this to our attention. We have been able to replicate what you are seeing.

We have notified our development team of this issue and will notify you here when this improvement is made.
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Hi Stephen, Would you have an ETA on this?

Thanks
Gyan
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
This is actually working as designed. The "models.saved" event is published whether or not the save was successful. It's more of a "hey, you told this model to save" event.
It is working as designed right now, but it is being categorized as an improvement story. It wouldn't be coming anytime soon. It's not on any near term roadmap.
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Hi Stephen, 

So, is there any way to find out if there was an error or not  from action framework ? 

Also, when I double checked skuid api for events :
https://docs.skuid.com/v11.0.0/en/skuid/api/skuid_events.html

For 'saved' event,  document says : "totalsuccess (boolean): A Boolean that is true only if all save operations (whether inserts, updates, and/or deletes), on all rows, on all model(s) involved, had no errors.". However when I checked in console totalsuccess is true even if there is an error.

Any clue?

Thanks.
Gyan
Photo of Jnanendra Pande

Jnanendra Pande

  • 160 Points 100 badge 2x thumb
Can I get an update on this please?

Thanks 
Gyan
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Our documentation team has been notified and they are updating the documentation to better reflect the current way things are working. Our apologies for any inconsistencies.
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Any update on this yet?
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Seems like this has been fixed in Millau 11.0.5