cancel
Showing results for 
Search instead for 
Did you mean: 

Data Validation Rule ending in increments of .25

Highlighted
Fry Chef
Fry Chef

Data Validation Rule ending in increments of .25

Jump to solution

I was wondering if anyone knew how to create a data validation rule in the SFM Transaction Designer that would only allow a number field to end in increments of .25, so .00, .25, .50 and so on?  I have tried setting the expression to Field__c = 1.25 just to see if it would work and it didn't.....I know this is a pretty vague explanation, but possibly somebody else has run into this problem and knows a work around. Any help is appreciated. Thank you!

1 Solution

Accepted Solutions
Highlighted
Employee
Employee

Re: Data Validation Rule ending in increments of .25

Jump to solution

Hi Dawn,

You can create a standard Salesforce validation rule which will display an error message in the SFM like the screen shot below and won't let the user save the SFM unless they enter their time in 0.25 increments.

Here is the Validation rule formula to accomplish this:

IF( AND(

CONTAINS( TEXT(test_duration__c), "."),

NOT(

OR( RIGHT( TEXT(test_duration__c), 2) == ".0",

RIGHT( TEXT(test_duration__c), 2) == ".5",

RIGHT( TEXT(test_duration__c), 3) == ".00",

RIGHT( TEXT(test_duration__c), 3) == ".25",

RIGHT( TEXT(test_duration__c), 3) == ".50",

RIGHT( TEXT(test_duration__c), 3) == ".75"

))), true, false)

Unfortunately, you can't just reference a similar formula field inside the SFM Data Validation rules since the formula won't update until the record is saved.

You may also want to try using a MOD operator formula like MOD(Duration__c,0.25) and adding some additional logic so it evaluates to true or false.

Good luck!

validationrule‌

View solution in original post

Highlighted
Employee
Employee

Re: Data Validation Rule ending in increments of .25

Jump to solution

Hi Dawn,

You can create a standard Salesforce validation rule which will display an error message in the SFM like the screen shot below and won't let the user save the SFM unless they enter their time in 0.25 increments.

Here is the Validation rule formula to accomplish this:

IF( AND(

CONTAINS( TEXT(test_duration__c), "."),

NOT(

OR( RIGHT( TEXT(test_duration__c), 2) == ".0",

RIGHT( TEXT(test_duration__c), 2) == ".5",

RIGHT( TEXT(test_duration__c), 3) == ".00",

RIGHT( TEXT(test_duration__c), 3) == ".25",

RIGHT( TEXT(test_duration__c), 3) == ".50",

RIGHT( TEXT(test_duration__c), 3) == ".75"

))), true, false)

Unfortunately, you can't just reference a similar formula field inside the SFM Data Validation rules since the formula won't update until the record is saved.

You may also want to try using a MOD operator formula like MOD(Duration__c,0.25) and adding some additional logic so it evaluates to true or false.

Good luck!

validationrule‌

View solution in original post