-1

I want to write a Validation Rule where close date cannot be set in past, but if Sys Admins require, only they can edit closed date to past dates.

Below is the Validation Rule rule which I have written but it is not working as per plan.

CloseDate < Today()&&
NOT( ISPICKVAL($User.User_Type__c, "Administrator"))
4
  • why not just use $Profile.Name <> "System Administrator" as also mentioned by sanket
    – User6670
    Commented Feb 25, 2020 at 13:00
  • @User6670 you want code to look like below :- AND( ISCHANGED(CloseDate), CloseDate < TODAY(), NOT( ISPICKVAL($Profile.Name <> "System Administrator")) )
    – Rajsxx
    Commented Feb 25, 2020 at 13:07
  • AND( ISCHANGED(CloseDate), CloseDate < TODAY(), $Profile.Name <> "System Administrator" )
    – User6670
    Commented Feb 25, 2020 at 13:09
  • @User6670 This works, thank you.
    – Rajsxx
    Commented Feb 25, 2020 at 13:12

1 Answer 1

0

You must also check in the validation rule weather you are changing the closed date or not. Apart from this, you are checking the current user record User_Type__c value. You can look for user profile as well unless you do want to skip for other profile users as well.

Updating as per comment

To check the profile name you can do like this:-

AND(
  ISCHANGED(CloseDate),
  CloseDate < TODAY(),
  $Profile.Name <> "System Administrator"
)
1
  • I want the VR to act in such a way that sys admins can change the closed date to past.
    – Rajsxx
    Commented Feb 25, 2020 at 12:56

Not the answer you're looking for? Browse other questions tagged .