Loading

Input Values Exceeding "Decimal Places" Are Automatically Rounded

Data pubblicazione: Dec 16, 2025
Descrizione

In Number, Currency, and Percent fields, entering a value with more decimal places than configured in the field definition results in the system automatically rounding and saving the value by default. This article explains how to prevent input values from being modified unintendedly by using the MOD function in a Validation Rule. This setup displays an error message when an input exceeds the specified number of decimal places.

Risoluzione

The logic used in the Validation Rule formula is to "shift the decimal point to the right (by multiplying), and if a decimal value still remains (the remainder when divided by 1 is not 0), trigger an error."

【Example】 Limiting input to 2 decimal places
To evaluate the value, multiply the number by 100 to shift the decimal point two places to the right.

  1. Valid Case (Saved successfully)
    Input Value: 123.45
    Shift right by 2 (x100): 12345
    Result: Since no decimal remains, the value is saved.
  2. Error Case
    Input Value: 123.456
    Shift right by 2 (x100): 12345.6
    Result: Since a fractional part (".6") remains, the Validation Rule triggers an error.

【Formula Configuration】
Configure the actual formula as follows:

  1. For Number and Currency Fields Set the number of zeros for multiplication according to the number of decimal places you want to limit.
    (Example) To limit to "2 decimal places":

    MOD( FieldName__c * 100, 1 ) <> 0

    Note: Replace FieldName__c with the API Name of your Number or Currency field. Because we want to check up to the 2nd decimal place, we multiply by 100 (two zeros) to shift the decimal point.

  2. For Percent Fields Percent fields are stored in the database as a value divided by 100 (e.g., 10% is stored as 0.1). Therefore, in addition to the visible decimal places on the screen, you must account for the digits used for the percentage conversion.
    (Example) To limit to "2 decimal places" as displayed on the screen:

    MOD( FieldName__c * 10000, 1 ) <> 0

    Note: Replace FieldName__c with the API Name of your Percent field. You need to shift by a total of 4 digits: the "2 decimal places" visible on the screen plus the "invisible 2 digits" (due to the /100 storage specification). Therefore, multiply by 10,000 (four zeros).

Numero articolo Knowledge

005132292

 
Caricamento
Salesforce Help | Article