+ Start a Discussion

Opportunity Formula Calculation

We would like to have a final estimate field by a total hours field which is different for each opportunity in order to input into the hourly rate field (weighted hourly rate calculation). Example $65,500 "final estimate" / 1,230 "total hours" = "$53.25 weighted hourly rate" we would like this field to auto populate once the input values have been inserted and make the input value fields mandatory should either one receive data. We would also like to have the field automatically update should one or both of the input values be changed and saved.







This is a toughie.... Ordinarily, people would just use a formula field to display the ""final estimate" / 1,230 "total hours" = "$53.25 weighted hourly rate" calculation.... but I assume you want this while in edit mode.



The only way I can think of is to have a "Compute final estimate" button", that displays a Apex page Modal popup that enters your data, and you use javascript to compute your weighted hourly rate.  I wish I had a better idea, but that's pretty much how I see it.


You also have to have the popup re-display the opportunity page, which will cause an annoying flicker.





Jeff MayJeff May

If you decide to use a VF page for data entry, you can put an <apex:actionSupport event="onchange" ...> on the input field, then have controller method that does your calculations and updates the screen. No flicker involved.