I do a LOT of work with percentage fields… calculating margins, markups, markdowns, fees, discounts etc.
Most of the time, due to the size of the end result formula fields I can not do these percentage calculations as formulas.
Add Fee A @ 2.75% of Base Prices
Add Fee B @ 1.258% of Base Price
Add Fee C @ 4.85% of Subtotal Price
Discount Total by 1.035%
Then multiply the Sale Price by 1/1.095 to get the Net Amount
If you’ve ever been to Dreamforce, remember the shock of getting your hotel bill and seeing all the various taxes detailed out… something like that.
I’ve been using Flows to clone records…
But I have to do something like
If Party X is paying the fee then put the percentage into Fee A% field, otherwise put the fee into Fee B% field
If Party Y is paying the fee then do the opposite.
I could NOT work out why my percentages were always incorrect in Flows
So I’ve done some testing.
I have 4 percentage fields - each of them are 3 decimal places:
Set a number variable as a passed in percentage field
Input a percentage field
Update percentage field from the previously saved value
Update a percentage field from a formula
Update the Record
Update the record with the exact value from the same field on the Get Record
Update the field with the passed in variable percent
Update the field with the input percent
Update the field with the formula percent. The formula is just the value of the exact field that is being updated, from the Get Record.
Passed in Variable then into a formula (not pictured)
WHY oh WHY is there a difference! Why when I use a Variable in a formula does it stay as the full number, but using a value retrieved from a record in a formula converts it to the percentage???
If you need to deal with percentage fields in a formula, IF the value comes from a Get Record ensure you multiply the value by 100 before using it in an Update in Flow. if the value comes from a Variable and the Variable is then used in a formula, don’t multiply it by 100. Confusing!
This may have seemed obvious, but it wasn’t until I went through it step by step.