I have a form that has a "Miles Traveled Field", which is filled out by the user, as well as "Rate".
Then I'd like a calculation to happen Miles Traveled * Rate which should populate the field "Amount".
How can I achieve this in apex?
To make calculation on page, without server - you can use Dynamic Actions (Javascript). On a page with "Page properties", click "+" in "Dynamic Actions" section, then pass steps:
Event
- firing event type (click, change, set focus...), Selection type
and Item
- item, where user have to click (change, set focus...), and conditions$v('P_ITEM_NAME_FOR_Miles_Traveled') * $v('P_ITEM_NAME_FOR_Rate');
There are number ways to make execution on a server side (dynamic action, process, etc), but in this case it is not appropriate. I can describe later if you need.