+ Start a Discussion
Charni WigginsCharni Wiggins 

Validation rule date cannot be after Today

Hi All,

I have a simple Val rule that I can't get working...

Cut_Off_INTERNAL_USE_ONLY__c is a formula field created from CreatedDate, gets the 4th day of next month. I need users to not be able to edit after this date... 
 
AND( 
TODAY() > Cut_Off_INTERNAL_USE_ONLY__c, 
ISCHANGED( TR1__Salary__c ),
ISCHANGED( TR1__Fee_Percentage__c ),
ISCHANGED( Extras_Amount__c ),
$Profile.Name != "System Administrator (Finance)", 
$Profile.Name != "Cobalt Finance", 
$Profile.Name != "Talent Rover Administrator", 
$Profile.Name != "UK Manager Backbone" 
)

Appreciate any help! :)
 
Best Answer chosen by Charni Wiggins
Steven NsubugaSteven Nsubuga
AND( 
TODAY() > Cut_Off_INTERNAL_USE_ONLY__c, OR( 
ISCHANGED( TR1__Salary__c ),
ISCHANGED( TR1__Fee_Percentage__c ),
ISCHANGED( Extras_Amount__c )), OR(
$Profile.Name != "System Administrator (Finance)", 
$Profile.Name != "Cobalt Finance", 
$Profile.Name != "Talent Rover Administrator", 
$Profile.Name != "UK Manager Backbone" )
)

 

All Answers

Steven NsubugaSteven Nsubuga
AND( 
TODAY() > Cut_Off_INTERNAL_USE_ONLY__c, OR( 
ISCHANGED( TR1__Salary__c ),
ISCHANGED( TR1__Fee_Percentage__c ),
ISCHANGED( Extras_Amount__c )), OR(
$Profile.Name != "System Administrator (Finance)", 
$Profile.Name != "Cobalt Finance", 
$Profile.Name != "Talent Rover Administrator", 
$Profile.Name != "UK Manager Backbone" )
)

 
This was selected as the best answer
Charni WigginsCharni Wiggins
Hi Steven, thank you for your comment - would you mind explaining why I need to add the OR's? 
Steven NsubugaSteven Nsubuga
The first OR indicates that if any of TR1__Salary__c, TR1__Fee_Percentage__c  and Extras_Amount__c  changes, 
the second OR indicates that if the user's profile is not any one of System Administrator (Finance), Cobalt Finance, Talent Rover Administrator and UK Manager Backbone,
Charni WigginsCharni Wiggins
Hi Steven,

I don't understand why it shouldn't work in one AND though - all must be true. 

Anyway, thank you very much, it works! :)