new record custom save action on spark

edited January 3, 2020 in Questions
Since upgrading a test environment to Spark I have found a number of our pages are behaving differently when a user hits our custom "Save & Close" button (screenshot of the high level actions below). 


When the user hits "Save & Close" the page hangs and permanently freezes. (screenshot below)


In another test environment.on Skuid version 11.2.10 I am able to create records of the same type and page xml, using the same "Save & Close" button without issue.

Affected page XML below

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" cachepage="true">
    <models>
        <model id="Task" limit="1" query="false" createrowifnonefound="true" datasource="salesforce" sobject="Task" processonclient="true">
            <fields>
                <field id="Subject" overridemetadata="true" ogdisplaytype="COMBOBOX" displaytype="TEXT" picklistsource="manual"/>
                <field id="OwnerId"/>
                <field id="Owner.Name"/>
                <field id="ActivityDate"/>
                <field id="WhatId"/>
                <field id="What.Name"/>
                <field id="WhoId"/>
                <field id="Who.Name"/>
                <field id="Format__c"/>
                <field id="Status"/>
                <field id="Priority"/>
                <field id="Description"/>
                <field id="Category__c"/>
                <field id="Cluster__c"/>
                <field id="IsRecurrence"/>
                <field id="ReminderDateTime"/>
                <field id="IsReminderSet"/>
                <field id="CreatedDate"/>
                <field id="Id"/>
            </fields>
            <conditions>
                <condition type="param" value="WhoId" field="WhoId" operator="=" enclosevalueinquotes="true" novaluebehavior="" state=""/>
                <condition type="param" value="WhatId" field="WhatId" state="" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
                <condition type="userinfo" value="" field="OwnerId" fieldtargetobjects="User" operator="=" enclosevalueinquotes="true" userinfotype="userid"/>
            </conditions>
            <actions/>
        </model>
        <model id="TaskRelation" limit="20" query="false" createrowifnonefound="false" datasource="salesforce" sobject="TaskRelation" processonclient="true">
            <fields>
                <field id="IsWhat"/>
                <field id="RelationId"/>
                <field id="Relation.Name"/>
                <field id="TaskId"/>
                <field id="Task.Subject"/>
                <field id="Id"/>
                <field id="Relation.Id"/>
            </fields>
            <conditions>
                <condition type="modelmerge" value="" field="TaskId" fieldtargetobjects="Task" operator="=" model="Task" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <buttonset model="Task" uniqueid="sk-3dfmhM-307">
            <buttons>
                <button type="multi" label="Save &amp; Close" uniqueid="sk-1BoZDZ-81">
                    <actions>
                        <action type="blockUI" message="Saving..."/>
                        <action type="save">
                            <models>
                                <model>Task</model>
                                <model>TaskRelation</model>
                            </models>
                            <onerroractions>
                                <action type="unblockUI" message="There was an error" timeout="3000"/>
                            </onerroractions>
                        </action>
                        <action type="requeryModel" model="Task" behavior="standard"/>
                        <action type="closeAllPopups"/>
                        <action type="custom" snippet="PageRefresh"/>
                        <action type="unblockUI"/>
                    </actions>
                    <hotkeys/>
                    <renderconditions logictype="and"/>
                    <enableconditions/>
                </button>
            </buttons>
        </buttonset>
        <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Task" uniqueid="sk-3IgwET-164" mode="edit">
            <columns>
                <column width="50%">
                    <sections>
                        <section title="Task Information" collapsible="no">
                            <fields>
                                <field id="Subject" valuehalign="" type="" required="true" uniqueid="sk-1BoZDi-87">
                                    <renderconditions logictype="and" onhidedatabehavior="keep"/>
                                    <enableconditions/>
                                </field>
                                <field id="Format__c" valuehalign="" type="" uniqueid="sk-1BoZDk-89"/>
                                <field id="OwnerId" valuehalign="" type="" required="true" uniqueid="sk-1BoZDm-91">
                                    <label>Assigned To</label>
                                    <filters>
                                        <filter type="fieldvalue" operator="=" enclosevalueinquotes="true"/>
                                    </filters>
                                </field>
                                <field id="Description" valuehalign="" type="" uniqueid="sk-1BoZDq-93">
                                    <label>Comments</label>
                                </field>
                            </fields>
                        </section>
                    </sections>
                </column>
                <column width="50%">
                    <sections>
                        <section title="Date Information" collapsible="no">
                            <fields>
                                <field id="Status" valuehalign="" type="" required="true" uniqueid="sk-1BoZD--97"/>
                                <field id="Priority" valuehalign="" type="" required="true" uniqueid="sk-1BoZE3-99"/>
                                <field id="ActivityDate" valuehalign="" type="" uniqueid="sk-1BoZE5-101">
                                    <label>Due Date</label>
                                </field>
                            </fields>
                        </section>
                    </sections>
                </column>
            </columns>
            <renderconditions logictype="and"/>
        </basicfieldeditor>
        <wrapper uniqueid="sk-1pac-553">
            <components>
                <grid uniqueid="sk-1pac-360">
                    <divisions>
                        <division behavior="flex" verticalalign="top" minwidth="100%" ratio="1">
                            <components>
                                <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Task" uniqueid="sk-1pac-652" mode="read">
                                    <columns>
                                        <column width="100%">
                                            <sections>
                                                <section title="Description" collapsible="no">
                                                    <fields/>
                                                </section>
                                            </sections>
                                        </column>
                                    </columns>
                                </basicfieldeditor>
                            </components>
                        </division>
                        <division behavior="flex" minwidth="19%" ratio="1" verticalalign="top">
                            <components>
                                <richtext multiple="false" uniqueid="sk-1pac-401">
                                    <contents>&lt;p&gt;&lt;strong&gt;&amp;nbsp; Related To&lt;/strong&gt;&lt;/p&gt;
</contents>
                                </richtext>
                            </components>
                        </division>
                        <division behavior="flex" verticalalign="top" minwidth="81%" ratio="1">
                            <components>
                                <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="Task" uniqueid="sk-1pac-410" mode="edit">
                                    <columns>
                                        <column width="100%">
                                            <sections>
                                                <section title="Section A" collapsible="no" showheader="false">
                                                    <fields>
                                                        <field uniqueid="sk-Q1m-404" type="COMBO" editmodebehavior="autopopup" readonly="true">
                                                            <label>{{WhatId}}</label>
                                                            <template>
                                                                <contents/>
                                                            </template>
                                                        </field>
                                                    </fields>
                                                </section>
                                            </sections>
                                        </column>
                                    </columns>
                                </basicfieldeditor>
                                <search uniqueid="sk-KiB-396" soslfields="Name Fields" placeholdertext="To change the default 'related to' record, enter search term here " boxwidth="50px" cssclass="seniorSearch" preventchange="true">
                                    <resultactions/>
                                    <focushotkeys/>
                                    <objects>
                                        <object datasourc

Comments

  • edited January 3, 2020
    Is the javascript hanging? Any developer console error messages? Can you compare the results of console.log(arguments); between Spark and Millau?
  • edited January 2, 2019
    Hi Mike, thanks for getting back to me. I've attached a couple of screenshots which may help. If not, are you able to point me in the right direction as to what I should be looking for?

    Salesforce developer console alongisde skuid page in spark, no errors

    image

    Browser developer console when saving in spark, again no errors from what I can see.

    image
  • Rob HatchRob Hatch 💎💎💎
    edited January 2, 2019
    Here is the block of xml you have to study: 

    <buttons>
                    <button type="multi" label="Save &amp; Close" uniqueid="sk-1BoZDZ-81">
                        <actions>
                            <action type="blockUI" message="Saving..."/>
                            <action type="save">
                                <models>
                                    <model>Task</model>
                                    <model>TaskRelation</model>
                                </models>
                                <onerroractions>
                                    <action type="unblockUI" message="There was an error" timeout="3000"/>
                                </onerroractions>
                            </action>
                            <action type="requeryModel" model="Task" behavior="standard"/>
                            <action type="closeAllPopups"/>
                            <action type="custom" snippet="PageRefresh"/>
                            <action type="unblockUI"/>
                        </actions>


    You already have "on error actions" on the save action.  So it looks like that is working.  Can you tell if the task records are getting created?  Next start adding "on error actions" to the subsequent action steps.  They should be available on the Requery and on the Snippet actions.  



  • edited January 3, 2020
    Thanks Rob, the task records are being created.

    Below is a screenshot of the on error actions I've added. If I now go ahead and try to create a task nothing different happens, the page hangs saying "Saving..." no error message is produced.

  • edited September 3, 2019
    Glenn, sorry for the long delay. Also, I had misread the javascript tag and thought the "PageRefresh" snippet was including code that I now see as the "relatedToRenderer" snippet.

    But, I also notice that the onerroraction highlighted by Rob is an unblockUI. This action type would not display the "There was an error" message. For grins, remove the "un" from the xml, or in the composer, delete and recreate the onerror action. That doesn't look like a problem that would hang the action script, however.

    The next thing I would try it to change the blockUI action to expire after 1 second, or even remove the action entirely for the time being. See if other errors are displayed without the block on the UI.

    Following that, add a console.log("Got Here"); statement to the PageRefresh javascript. I'm not sure if it would make sense to add a second console.log() after the location.reload(), but that might show something. You could also execute the location.reload() statement right from the browser console.

    Actually, I'm wondering about the sequence of actions: If you block the ui, then do a location.reload(), and then unblock the UI, does the unblock execute? Should you reverse those actions? Of course, one also wonders why that would be a problem in Spark but not Millau. But different architecture: in Millau, the javascript may actually execute after the unblockUI action.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!