Percentage Fields in Flows
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.
Eg
Base Amount
Add Fee A @ 2.75% of Base Prices
Add Fee B @ 1.258% of Base Price
Subtotal
Add Fee C @ 4.85% of Subtotal Price
Total
Discount Total by 1.035%
Gross Amount
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
No. | Field Type | Start Value | End Value |
---|---|---|---|
1 | Update the record with the exact value from the same field on the Get Record | 2.55 | 2.55 |
2 | Update the field with the passed in variable percent | 2.789 | 2.789 |
3 | Update the field with the input percent | 10.543 | 10.543 |
4 | 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. | 8.253 | 0.083 |
| Passed in Variable then into a formula (not pictured) | 2.789 | 2.789 |
End Value
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.