Loading

Currency and Number Fields Round When There Are More Than 15 Characters to the Left or Right of the Decimal

Дата публикации: Jul 30, 2025
Описание

If you have a currency or number field where the field length is set to 16 or more characters to the left or right of the decimal point with 2 decimal places, the decimal value rounds in unexpected ways. This rounding can also happen in a number field with no decimals where the numeric value is longer than 15 digits.

For example:

1,222,333,444,555,666.88 becomes 1,222,333,444,555,667
1,222,333,444,555,666.84 becomes 1,222,333,444,555,666.80
1,222,333,444,555,666.56 becomes 1,222,333,444,555,666.50
1,222,333,444,555,666.35 becomes 1,222,333,444,555,666.20
1,222,333,444,555,666.12 becomes 1,222,333,444,555,666
49.9999999999999972 becomes 50
9999999999999999 becomes 10000000000000000


This behavior is due to how JavaScript handles numbers and isn’t something Salesforce can control.

If you specify lengthy currency strings via the API, some users interacting with these fields through the UI can experience the JavaScript rounding behavior. If a user saves such a record through the UI, they introduce the rounded value to the database. If any Salesforce validations require that the database value be unchanged, this rounding is seen as a change and triggers the validation.


This behavior is expected, and occurs via the UI in Lightning Experience and via the API using REST API or Bulk API. This same rounding can be seen in the Developer Console when entering a value in a number field.

See Data type number field can store more decimal places than defined.

 

 

 

Номер статьи базы знаний

000394530

 
Загрузка
Salesforce Help | Article