Updated Field-value on Row Not Displaying Properly After updateRow()

  • 1
  • Problem
  • Updated 3 years ago
  • Solved
  • (Edited)
Hi

I've got some number fields of which I calculate the total value and then store that value into another number field on the same row (I'm using a custom field renderer for that). The calculation works fine and the updateRow() as well.
The only problem I've got now is that the total value doesn't get displayed correctly. Meaning if I update a field to 1, the displayed total is 0. However if I update a second field (or the same field, it doesn't matter) to 1 or 2, the total now is 1 (its displayed in a template field)
Long story short: the displayed total is always "one step behind" as it should be.
We've got the same snippets and renderers there are on that page running perfectly working on another page. The only difference are the models (and yes the fields are spelled correctly).
I've now wasted at least 4 hours trying to find another way to calculate/update the field and compared the page to the other page that works properly (everything is exactly the same).
Do you guys have any knowledge of this error/bug?

Here's some "proof":


Those are the fields displayed on the UI. The green value is the total of the fields above and always one step behind.


Those are the model properties (updated correctly) at the exact same state as the screenshot above...


This is the part with the update action in my field renderer.


Cheers
Photo of David Giger

David Giger

  • 1,758 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
Hi David -

I've had this problem before.  The reason it's one step behind is because the field that you are updating is marked as 'readonly' (e.g. it might be a formula field in SFDC).  Due to do the way Skuid processes data, it won't automatically update the UI when changes occur to readonly fields - this is intentional for performance reasons as readonly fields shouldn't be changing.

Check out the following for more information and specifically look for the function makeFieldsEditable in the 1st link:

https://community.skuidify.com/skuid/topics/update-a-formula-field-if-lookup-value-changes-on-table-...

https://community.skuidify.com/skuid/topics/read-only-field-not-rendering-properly-after-update


With all that said, now that we have UI Only fields, you might be able to avoid this metadata manipulation and move your data to UI Only fields to achieve the same result.
Photo of David Giger

David Giger

  • 1,758 Points 1k badge 2x thumb
Hi Barry

Thanks for your input.
After rechecking the model, I noticed that the fields were set to read-only (not in SFDC but in Skuid using the override field metadata). After I've disabled that, everything is working fine now.

Thanks so much, you made my day :)

Cheers
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I"m always glad when a day is made!  Thanks Barry.