Here’s the summary of the problem: A mass action on a table (perhaps only in a wizard) in a popup uses the context of the pagetitle component that launched the popup rather than the rows selected on the table for a create row(s) action.
A complete description:
I have a page which is designed to assign a custom version of ‘tasks’ to users via a junction model.
I have a page title on Model A with a button. The button queries Model B and opens a popup.
The popup contains a wizard which contains 3 steps. The first step is just selecting some users (trainee and trainer) from lookups on a dummy model to be used in a create row operation. The second step shows a table on Model B, which is a list of all available tasks. This table has a mass action setup to create rows on the junction object (Model C, called "Training_CreateIndividualTraining), like this:
The third step shows a table on Model C so you can check the tasks that have been created, if any.
Except, the mass action doesn’t work.
Here’s the table on Model B:
Notice that I’ve selected all rows, and that the ID field is in the 3rd column.
Here’s the result of the mass action:
One row was created, and it has the wrong Id.
The context that the create row mass action is using is apparently not the selected rows of the table. Instead, it’s using the row of the page title component that launched the popup.
Can you recreate a simple reproduction page using standard objects? I can try and use your steps to recreate one, but there are quite a few for this one and it’ll take some time to get back to you.
Thank you for bringing this to our attention. I have been able to reproduce this error and have it logged within our system. I’ll update here when the fix is released. We do not have a workaround currently. We have noticed that this behavior only affects pop ups in Button Sets and Page Titles.
Seems like the obvious thing in this case is to use a brute-force javascript method. Shouldn’t be too difficult to build a snippet that will get the selected rows in the table, build a rowsToCreate object, and run createRows().
I have requested for a quick workaround from the devs but unfortunately this is two issues. 1. The context is screwy. 2. Mass Actions are only creating one record. I have not tried approaching this from a “Page Include within the Pop Up” method. That might work but would take some building.
The page include is probably the way to go, particularly in our case since we don’t care what the context of the component that is launching the popup is. We wouldn’t even need to pass any parameters to the page include in this case.
so…any updates on this? I’m running into same issue. I’m trying to reproduce the functions of a “clone” button on a record in a deck. I’ve selected “create new row” as the first action and under “rows to use” I’ve selected “rows in context” but it is still pulling the data from the 1st row in the model.
Am I misunderstanding what the “rows in context” means?
I seem to be having this issue with relation to using the “Adopt Rows into Model” as a “Mass Action” - it is not considering the rows in context, just all rows.
Here is a workaround to this problem. (though were gonna fix the problem)
If you can move the “create row” action to happen as a separate sequence that is fired on each row - the data context will be correct.
So the mass action could simply update a field value on the row. And a model action on that row update could trigger the row creation. The model action would repeat every time and should get the right data context for the pre-population steps.
I hope this helps anyone who finds this post sometime in the future.
this also has the unfortunate side-effect of, if trying to mass create rows, pushing an “update the UI display” call with each row created. If a table was ever displayed on the page, this can cause a massive slowdown when creating the rows in a loop, and can even cause your page to freeze.
As a workaround to this, I generally run my mass row creation in a duplicate model that has the same properties as my original model, just named “_NODISPLAY” because I never display it on the page, therefore the individual row creates don’t push a UI display update. When done creating rows in that model I then adopt all rows from that model into my normal displayed model.
It would be great if this wasn’t so complicated and we simply had a “createRows” function that accepted an array of field value pairs, similar to how updateRow also has an updateRows function.