We have several formula fields that we want to keep in sync with client side logic. We’ve placed these fields in field editors, tables, etc., however after updateRow is called on the field, the new value is not correctly reflected. From what I can tell, this only appears to occur when the SFDC field is read-only. I’m not certain if this might be by design, however as you’ll see below, certain situations will force the proper re-rendering of the data.
I’ve granted login access and created test pages called “SampleFormulaFieldDoesNotRerenderAfterUpdateRowRepro” & “SampleFormulaFieldDoesNotRerenderAfterUpdateRowWithSecondFieldUpdatedRepro.”
Steps to Prepare:
1) Create an SFDC object that contains a formula (e.g. quantity, price and extended price)
2) Create a object detail page
- condition on URL param ‘id’
- add a field editor (read with inline edit) with quantity, unitprice, extended price and a template for extended price
- add a table (read with inline edit) with same fields
- create custom snippet to calculate value for extendedprice and updaterow
- add action to run custom snippet on model update
Steps to Reproduce:
1) Preview page
2) Toggle Edit Mode on field editor for Unit Price and change value - Note none of the extended price fields change but the Unit Price of the table stays in sync
3) Toggle Unit Price back to read mode - Note that none of the extended price fields reflect the correct value
4) Toggle edit mode on field editor for Unit Price and change value - Note that the template version of the extended price fields change to reflect a different value but it is the value that was calculated from the result in #2 not in #4 (it’s basically one step behind). Also note that neither of the Extended price (non-template) fields have been updated.
5) Click the edit icon on the table row to toggle to edit mode for the row - Note that both extended price fields in the table now contain the correct value but the extended price fields in the field editor are incorrect with the extendedprice (non-template) field still containing the initial value
6) Change the unit price in the table row and toggle back to view mode - Note that both extended price fields in the table now contain the correct value but the extended price fields in the field editor are incorrect with extendedprice (non-template) field still contain the initial value
Now for the interesting part…
1) Add a new field to SFDC object (any text field is fine)
2) Update the snippet to include this field in addition to extended price in the updateRow call
3) repeat steps above - Note that the template field is properly kept in sync at all times. However, the extendedprice (non-template) is only updated in the table on edit/view mode toggle and the extendedprice (non-template) in the fieldeditor is never updated
Possible Workarounds
1) Use a template field and ensure that more than one field is included in the updateRow call (e.g. contain a fake field).
2) Use custom renderer (on a field that is not marked as read-only by SFDC). The challenge with this approach is that we use the calculated value in other areas and would incur the perf hit to recalculate values multiple times (some of our calcs are rather complicated). Not the worst thing in the world but not ideal. Being able to just use the formula field and have the client logic take over for what the server side SFDC logic typically would do would be preferred.
3) Explicitly call field.render() on any registered field for the field that was updated
Thoughts?
Thank you!
Question
Read-Only field not rendering properly after update

Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.