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

Quarter Hour Intervals with Validation Rule

So I am trying to validate time entrys in quarter hour increments. Ex, 1, 1.25 = 1:15, 1.5 = 1:30, 1.75 = 1:45.
I have everything figured out, but when I try to enter a whole number like 1 or 2 or 3, I get an error. Below is my VR and its the fourth line that needs fixing in order to allow me to enter in a whole number. 

IF(VALUE(RIGHT(TEXT(project_cloud__Hours__c), 3)) <> 0.25, True, False), 
IF(VALUE(RIGHT(TEXT(project_cloud__Hours__c), 2)) <> 0.50, True, False), 
IF(VALUE(RIGHT(TEXT(project_cloud__Hours__c), 3)) <> 0.75, True, False), 
IF(VALUE(RIGHT(TEXT(project_cloud__Hours__c), 3)) <> 0.00, True, False) 
Best Answer chosen by FreddyS
Andrew GAndrew G
Not sure if you got this sorted, but I suspect that you are testing a number field.  With 2 decimal points.  And I suspect that Salesforce treats the Integer value slightlty differently to the entered decimal.

You could try an alternate way to test for quarter hour values.

IF ( MOD( project_cloud__Hours__c* 100, 25 ) <> 0 , TRUE, FALSE )

Basically, multiply the number out such that 1 become 100, or 1.25 become 125, or 7.45 become 745.  Then divide by 25 (your quarter value) and test the MOD.

A quick test in my environment worked for myself.  Both entering integer and decimal.