I am using the modern designer, and when using the getFieldValues function to retrieve the field value from a currency field, it is only returning the whole dollar amount. If I enter 100.50, then it returns 100.5. Any ideas?
Question
Question
getFieldValues is not retrieving the full value when using a currency field?
Answer
I don't think you need the rounding step since the math just cancels out.
If the value is numeric CurrencyField.toFixed(2) alone should be sufficient.
The reason for this behavior is that Currency is a "masked" field, meaning it stores a numeric value behind the scenes so they can be evaluated numerically in calculations, gateway conditions, etc.
However, the value is displayed as formatted text because leading/trailing zeros, commas, etc., are not valid for true numeric types.
100.5 and 1000.5 = numeric
'100.50' and '1,000.50' = text/string
Replies
I was able to resolve this by adding the following:
(Math.round(CurrencyField * 100) / 100).toFixed(2);
I don't think you need the rounding step since the math just cancels out.
If the value is numeric CurrencyField.toFixed(2) alone should be sufficient.
The reason for this behavior is that Currency is a "masked" field, meaning it stores a numeric value behind the scenes so they can be evaluated numerically in calculations, gateway conditions, etc.
However, the value is displayed as formatted text because leading/trailing zeros, commas, etc., are not valid for true numeric types.
100.5 and 1000.5 = numeric
'100.50' and '1,000.50' = text/string
Thanks for the explanation!