function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Javier MaldonadoJavier Maldonado 

Show dynamically formula fields before save the record

I'm working to build a custom application that allow me to get the price, on different levels, but my problem begins when I try to show the values on the formula fields (5 differents criteria to calculate the price) before save the record, because I have to fill some other fields, after to see what price level is attached to the customer, and keep this record saved according out process manual.

Currently I'm using "outputField", but doesn't work, because is not a dynamic binding in visualforce. I can show the label of each one of my fields but I cannot show the results. 

Any idea how can I resolve my issue?...
 
User-added image
Best Answer chosen by Javier Maldonado
bob_buzzardbob_buzzard
Formula fields are only populated when you retrieve a record from the database - they aren't fields that contain a value, instead they contain the formula and this is executed on the record that has been retrieved. Thus you can't dispaly these without saving a record to the database.  The best that you can do is to replicate the formulas in apex, which is a rather fragile solution.

All Answers

bob_buzzardbob_buzzard
Formula fields are only populated when you retrieve a record from the database - they aren't fields that contain a value, instead they contain the formula and this is executed on the record that has been retrieved. Thus you can't dispaly these without saving a record to the database.  The best that you can do is to replicate the formulas in apex, which is a rather fragile solution.
This was selected as the best answer
Javier MaldonadoJavier Maldonado
Thanks Bob...

Now I know that it's impossible for me to do it, because my price formula it's too complex, and it's not possible write a code to fire this formula with APEX... Thanks for your advice...