0
votes

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?

1

1 Answers

1
votes
  1. 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:

    • Identification: enter a name for action
    • When: Event - firing event type (click, change, set focus...), Selection type and Item - item, where user have to click (change, set focus...), and conditions
    • True action: you need to select action type "Execute JavaScript Code". In a field for code input you need to enter something like this:

    $v('P_ITEM_NAME_FOR_Miles_Traveled') * $v('P_ITEM_NAME_FOR_Rate');

  2. 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.