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
Danny@ReachLocalDanny@ReachLocal 

Validation Rule for checkbox using date

I'm trying to set up a validation rule that will not let you check on a checkbox (Re_opened__c) unless

1) there is a resolved date (Resolved_Date__c)

2) the resolved date is within 3 days of when a ticket is 're-opened', or current day

 

what i have so far is:

 

And(

Re_opened__c,

Not(Today()>Day(Date(Resolved_Date__c) +3 )))

 

right now, it doesn't seem to like the number of parameters being used, also not sure if this is written correctly.  would appreciate some suggestions, thanks.

 

 

netTrekker_ADnetTrekker_AD

I am thinking the issue is you have no field mentioned that tracks when the ticket was reopened. You only mention the checkbox field Re_opened__c and the Resolved_Date__c fields. In order to write in the function that the resolve date is within 3 dats of when the ticket is reopened, you need a Re_Opened_Date__c field.

 

 

apex whistlerapex whistler

Assuming that Resolved_Date__c does not occur in the future, then we can simplify your formula to

 

 

AND(
Re_opened__c = TRUE,
ISCHANGED(Re_opened__c),
NOT( Resolved_Date__c +3 >= TODAY())
)

 

FYI, I added the ISCHANGED so it is possible to edit a "resolved" record without the validation rule triggering. Feel free to drop it.