"When Model saved" action firing before model is saved

GyanGyan Member
edited February 2018 in Problems
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

Comments

  • Stephen SellsStephen Sells Member
    edited November 2017
    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.
  • GyanGyan Member
    edited December 2017
    Hi Stephen, Would you have an ETA on this?

    Thanks
    Gyan
  • Stephen SellsStephen Sells Member
    edited November 2017
    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.
  • GyanGyan Member
    edited December 2017
    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


  • edited December 2017
    Can I get an update on this please?

    Thanks 
    Gyan
  • Stephen SellsStephen Sells Member
    edited December 2017
    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.
  • GyanGyan Member
    edited January 2018
    Any update on this yet?
  • GyanGyan Member
    edited February 2018
    Seems like this has been fixed in Millau 11.0.5
Sign In or Register to comment.