Saving UI only field result to a SF Field

  • 1
  • Question
  • Updated 2 years ago
  • Answered
  • (Edited)
I have set up a model action to update a SF field (Print Balance) with the value from a Ui-only  field (Balance). All but the first row for the Print Balance gets filled in and all rows don't save, just the second row.

Setup:
1. Model Actions:
  •  "Initiating Events" to "Row in Model updated" and for Fields, selected "Balance".
  • Actions "Update row(s) in Model", where Model is set to the same Model and the value is set to {{{Balance}}}. Save Model
Issue:
All rows do not update and save. If I manually click the save button all the italicized fields will save. If I keep refreshing the page the each next line will save per refresh.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
^bump^
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Workaround would be a snippet I think. Is the Balance UI only field calculating all at the same time for all rows? Either way, I think running a snippet would circumvent what seems like a bug if time is of the essence.

Run this snippet followed by a Save action.

var params = arguments[0],
	$ = skuid.$;

$.each(params.model, function(r,row){
    model.updateRow(row,'Print_Balance__c',row.Balance);
});

NOTE: this would not work as a Model action as each update would trigger model action. I think probably has something to do with the issue you're having. You're the Skuid page to perform an update and save actions for each Balance field updated. If you update more than one of them, I can see issues arising from having multiple save actions running on the same set of records.


All this to say, run the snippet and save just once and everything should be fine.

Alternatively, only update Print_Balance__c using an action and then manually Save.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Pat thanks for putting some brain power into this for me. I don't fully understand why the save doesn't work properly on a model action. I tried the script route before but that didn't work because there was not a button that I could easily attach the script to. But, the data lives in a table that is in a tab set. Adding the update row action to the tab did the trick. All rows get updated and saved! 
(Edited)