function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
K@SK@S 

Restricted two decimal points field type is percent.

Hi,

I Need to restrict two decimal points in field type is percent.

NOT(
 REGEX(TEXT(ABC__c),"\d+(\.\d{0,2})"))

But showing syntax error
Please help on this.
Ashish DevAshish Dev
I think best would be to have 2 decimal places allowed in field setting. This will make sure that whatever number is entered in record it would be rounded off to 2 digits after decimal.
K@SK@S
I don't want  to ROUND.
Ashish DevAshish Dev
Probably you need to escape back slashes with another back slashes.
Parker EdelmannParker Edelmann
If this is an ordinary percent field, just edit the field definition so that it can't have more than two decimal points.
K@SK@S
I am using this formula but not working
"[0-9]+[.][0-9]{2}"

I want save the values
97.32
78.65
But
98.00(this is working)
Parker EdelmannParker Edelmann
Try "[0-9]\\p{.}[0-9]{2}" I don't know if that works, I know nothing about code, but that's what I could come up with based on these articles:

https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_functions_i_z.htm&language=en_US (http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)

http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html