update row field inside popup on button clicked

  • 1
  • Question
  • Updated 9 months ago
  • Answered
I am trying to update a field inside row action popup window using action "update field on row" added to button click. The problem is that it updates all the rows with the updated value whereas the desired result should be only updating the current row's field.
Photo of Salesforce Dev007

Salesforce Dev007

  • 308 Points 250 badge 2x thumb
  • confused

Posted 3 years ago

  • 1
Photo of Anthony Hare

Anthony Hare

  • 440 Points 250 badge 2x thumb
How are your actions set up?
Photo of Salesforce Dev007

Salesforce Dev007

  • 308 Points 250 badge 2x thumb
I have a table component that lists all the shipping items (uses relatedShippings model) which has a row action to open up a popup. Inside the popup I have field component with the same model (relatedShippings). I have a button inside that popup window which runs action (update field on row) to update status field on opened record to "shipped". The problem is that it changes all the items in the table component to "shipped".
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
There are several strategies you can use.  One option would be to read the row into a separate model and associate this new model with the field editor.  On Save, you will need to re-query the relatedShippings model to pick up the changes.
Photo of Salesforce Dev007

Salesforce Dev007

  • 308 Points 250 badge 2x thumb
Thanks for the reply. could you provide me info on how to move single row data to a model...I am not sure how to do this on skuid.
Photo of Michael L Barnes

Michael L Barnes

  • 176 Points 100 badge 2x thumb
Reading into a separate model worked for me!  I was able to use the initial context to set the Id of the current row on a secondary model, then create a record, then query that record to get the Id of the new record, then update a field on the "row in context" with the Id of the new record.   Prior to this I kept losing context, and my process was updating ALL records returned by the original model, which was a problem.
Photo of Michael L Barnes

Michael L Barnes

  • 176 Points 100 badge 2x thumb
So, thank you Irvin for the suggestion.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I think the basic problem is that somewhere in your action sequence tied to the row action - you are losing context.  This most often happens when you create a new row.   So if you can put your field update action first in your action sequence  the problem should not occur. 
Photo of Salesforce Dev007

Salesforce Dev007

  • 308 Points 250 badge 2x thumb
Thanks this works!! One other thing I needed to change was the model to the correct one on title component where the button was added. Also had to set context to "Id of records = Id of row in context" for the title component. 
(Edited)