0

I have field final result on which on certain values, I only want some of the users to make the changes. The problem is that the user Id which are not mentioned in the formulae are able to get the error message which is correct but those users which are mentioned in the users Id are also not able to change the values which is incorrect. I only want the users mentioned in the formulae to edit the values.Basically I want that if the final result has values (ACCEPTED,REJECTED,ACCEPTED-Team Foundation",the users mentioned in the formuale can change to next stage,rest not.

The formula is :

AND(NOT(OR(ISPICKVAL(Final_Result__c,"ACCEPTED"),ISPICKVAL(Final_Result__c,"REJECTED"),ISPICKVAL(Final_Result__c,"Accepted-Team Foundation"))),OR(($User.Username <> "005j000000CNXpO"),($User.Username <> "005j000000DM7GK"),($User.Username <> "005j000000DY8DN"),($User.Username <> "005j000000C04vl"),($User.Username <> "005j000000CO3h7"),($User.Username <> "005j000000C0BeQ"),($User.Username <> "005j000000CO3gi"),($User.Username <> "005j000000CO3hC"),($User.Username <> "005j000000CO3iP"),($User.Username <> "005j000000D4hiP")))
4
  • Try changing $user.Name <> some vale to = instead of <>. You'll likely need to remove the NOT that follows the AND at the beginning of the formula too. It's either that or the latter plus adding a NOT in front of the list of $user.Names since you're getting half of the behavior you want. So it would seem that you'd need to change the behavior for both halves of your formula and those are the two places where they'd seem to need to change.
    – crmprogdev
    Jun 19, 2016 at 20:28
  • 4
    You may find your question already answered here: Validation should not fire for a specific user
    – Adrian Larson
    Jun 19, 2016 at 22:16
  • I would recommend a custom permission for that case. Create a custom permission, create a PermissionSet containing that permission and assign it to all required users. After that custom permission can be checked in the rule with ($Permission.Custom_Permission_Name). This solution is flexible as you can add/remove users anytime by changing who has PermissionSet.
    – Andrei.Z
    Jun 20, 2016 at 2:01
  • Hi @Andrei.Z : when I use the formulae AND(OR(ISPICKVAL(Final_Result__c,"ACCEPTED"),ISPICKVAL(Final_Result__c,"REJECTED"),ISPICKVAL(Final_Result__c,"Accepted-Team Foundation")),$Permission.Users_can_change_final_result_and_5_min_result) , I get the error as Error: Field Users_can_change_final_result_and_5_min_result does not exist. Check spelling . Also I do not find $Permission into insert field on validation rule ,I have manually entered it Jun 20, 2016 at 3:51

1 Answer 1

0

You can use this trick.

  1. Prepare a string which will concatenate all the user names delimited by '#'

  2. Use Contains search in your formula. Mind to use UPPER Case.

And formula will be like this:

 AND(OR(ISPICKVAL(Final_Result__c,"ACCEPTED"),ISPICKVAL(Final_Result__c,"REJECTED"),ISPICKVAL(Final_Result__c,"Accepted-Team Foundation")),     
    NOT(CONTAINS(UPPER("005j000000CNXpO#005j000000DM7GK#005j000000DY8DN#005j000000C04vl"), UPPER($User.Username))))
1
  • Hi @Santanu : I am using the formulae now as : AND(OR(ISPICKVAL(Final_Result__c,"ACCEPTED"),ISPICKVAL(Final_Result__c,"REJECTED"),ISPICKVAL(Final_Result__c,"Accepted-Team Foundation")), NOT(CONTAINS(UPPER("005j000000CNXpO#005j000000DM7GK#005j000000DY8DN#005j000000C04vl#005j000000CO3h7#005j000000C0BeQ#005j000000CO3gi#005j000000CO3hC#005j000000CO3iP#005j000000D4hiP,"), UPPER([email protected],[email protected] .sandbox,[email protected],[email protected])))) but I get the systax error. Am I doing it wrong. Jun 20, 2016 at 3:56

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