Skip to main content

Hello

I am having an issue with the Mass Actions on a table I have. I have a table of accounts and I want users to be able to select records on the table to create a bunch of cases en masse based off of data on the account. I then want to update a date field on the account for the date that this happens.

I am having no issues creating the cases for all the accounts selected, but I am having issues on updating that date field on the account. I have the actions set up to update the account row with today’s date and then save the model, but it looks like these actions are only being processed when one account on the table is selected. 

When one account is selected the date is set and saved with no issue, but when multiple accounts are selected the date is not set and the model is not saved. All of the other actions are running just fine. I set the account model to block the UI if there’s an error on save, but that’s not popping up, so I don’t think it’s trying to save at all.

Is there any known issue on why this would work fine with one record selected, but not multiple? 

Hi Joe,


I’m wondering if you could try this simple test page out, and look at the two ways I think this should work.


This page creates a few dummy records, and has two tabs. In the first tab, you can see the built-in 'mass update selected records option, which appears when you select one or more rows in the table. That lets you update all records with the same field changes - your users could change several fields & records at once here. This should be working right out of the box.


The second tab shows how you might set up a mass action of your own to update the date field for selected records. I didn’t have to do very much to get this set up but one key item is that the “Rows to use” setting is set to “Rows in context” which means, rows the user has selected.


Can you try these out and let me know if they’re working as expected? If so, do they offer any insight on any differences in the settings your table / actions has?


<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true" theme="Clean Green">
<models>
<model id="Test" limit="20" query="true" createrowifnonefound="true" datasource="Ui-Only" processonclient="true">
<fields>
<field id="NewField" displaytype="UUID" ogdisplaytype="TEXT" label="NewField"/>
<field id="Date" displaytype="DATE" label="Date" defaultvaluetype="fieldvalue" ogdisplaytype="TEXT"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<tabset rememberlastusertab="true" defertabrendering="true" uniqueid="sk-38FA-491">
<tabs>
<tab name="Option 1 - Simple Mass Update Selected Rows">
<components>
<grid uniqueid="sk-38Et-390">
<divisions>
<division behavior="flex" minwidth="100px" ratio="1">
<components/>
</division>
<division behavior="flex" verticalalign="top" ratio="1" minwidth="100px">
<components>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="client" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Test" buttonposition="" mode="edit" allowcolumnreordering="true" responsive="true" uniqueid="sk-38Eg-306">
<fields>
<field id="NewField" uniqueid="fi-38Eg-307"/>
<field id="Date" uniqueid="fi-38Eg-308"/>
</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>
</division>
<division behavior="flex" verticalalign="top" minwidth="100px" ratio="1">
<components/>
</division>
</divisions>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</grid>
</components>
</tab>
<tab name="Option 2 Mass Action" loadlazypanels="true">
<components>
<grid uniqueid="sk-38FH-678">
<divisions>
<division behavior="flex" minwidth="100px" ratio="1">
<components/>
</division>
<division behavior="flex" verticalalign="top" ratio="1" minwidth="100px">
<components>
<skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="client" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Test" buttonposition="" mode="edit" allowcolumnreordering="true" responsive="true" uniqueid="sk-38FH-679">
<fields>
<field id="NewField" uniqueid="sk-38FH-680"/>
<field id="Date" uniqueid="sk-38FH-681"/>
</fields>
<rowactions>
<action type="edit"/>
<action type="delete"/>
</rowactions>
<massactions usefirstitemasdefault="true">
<action type="multi" label="Tag with Today's date" icon="sk-icon-calendar">
<actions>
<action type="updateRow" fieldmodel="Test" affectedrows="context" field="Date" enclosevalueinquotes="true" value="TODAY"/>
</actions>
</action>
</massactions>
<views>
<view type="standard"/>
</views>
</skootable>
</components>
</division>
<division behavior="flex" verticalalign="top" minwidth="100px" ratio="1">
<components/>
</division>
</divisions>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</grid>
</components>
</tab>
</tabs>
</tabset>
</components>
<resources>
<labels/>
<javascript/>
<css/>
<actionsequences uniqueid="sk-38EX-234">
<actionsequence id="8307511d-c683-450a-838e-d6dfcbc223c7" label="New Sequence" type="event-triggered" event-scope="component" event-name="page.rendered">
<description/>
<actions>
<action type="createRow" model="Test" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context"/>
<action type="createRow" model="Test" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context"/>
<action type="createRow" model="Test" appendorprepend="prepend" defaultmodefornewitems="edit" affectedrows="context"/>
</actions>
</actionsequence>
</actionsequences>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
<styleitem property="padding" value="64px"/>
</styles>
</skuidpage>

Hi Mark, thanks for the response.


So I tried out the test page and it’s working as intended. It really needs to be a mass action and not a mass update as it’s a field used in the background for other processes that the user won’t see. I’d like it to just be paired with the record create action.


I’ve got my row update action set up exactly the same as yours, but it’s still only working when only one row is selected.


 


Joe, is the table’s model also what we see in the Model setting in this screenshot?


Yes, it’s the same model.


This sounds much like the problems I have been having where context changes unexpectedly during a series of actions. I’ve also seen this running javascript as a mass action against selected rows, except maybe the reverse of Joe’s issue. I could run the js against the selected rows if I invoked it from a Button Set button of type Custom: Run Skuid Snippet. It failed (or maybe only affected one row) if the button type was Run Multiple Actions and called the same snippet. The code inside the snippet is getting argumentse0].component.context.rows, which I can walk as an array. I’m suspecting Joe is losing the context of his Account record when an array of selected Accounts is created.


Joe, do you set the Account date field before, or after, you create the cases?


I had it after the case create. Moving it up to the beginning of the action sequence did the trick. I guess that has to be a Skuid bug then since all I did was change the order of the actions. Luckily the order of those sequences doesn’t matter for this task.


Thanks Mike!


Glad that did it! I think skuid changed the context of context somewhere along the way, in Millau maybe. Hard to say for sure, since it seems every page is just a little different. But I’ve been having a lot more trouble with context recently and don’t think I’ve changed my approaches that much.


me too!


Reply