Not able to save calculated value into local variable

Certified Senior Developer

I am trying to calculate and save the value into local variable called local!grandtotal  using below code.

In the user interface I am able to see the value updated, But I am not able to see the value updated in the local variable.

Please advise some suggestions to resolve this.

  Discussion posts and replies are publicly visible

Parents
  • Saving a value into a local variable like what you want to have happen here, requires user interaction on a field.  You have the value of this field set correctly for showing the calculated total, however it won't actually perform the saveInto until/unless the user edits the field in some way and then clicks away.  I assume this is not what you want.

    Instead, you probably want your Grand Total field to be a read-only display; you have two options, one would be that you could calculate the Grand Total value in the value parameter of this field (which wouldn't solve the issue of saving it into local!GrandTotal), and the other option would be just basing it on local!GrandTotal -- in the latter case, you would need to do the calculation in the SaveInto fields of the other user input fields that it's based on -- maybe just local!cartDetails1.quantity.

Reply
  • Saving a value into a local variable like what you want to have happen here, requires user interaction on a field.  You have the value of this field set correctly for showing the calculated total, however it won't actually perform the saveInto until/unless the user edits the field in some way and then clicks away.  I assume this is not what you want.

    Instead, you probably want your Grand Total field to be a read-only display; you have two options, one would be that you could calculate the Grand Total value in the value parameter of this field (which wouldn't solve the issue of saving it into local!GrandTotal), and the other option would be just basing it on local!GrandTotal -- in the latter case, you would need to do the calculation in the SaveInto fields of the other user input fields that it's based on -- maybe just local!cartDetails1.quantity.

Children
No Data