You need to sign in to do that
Don't have an account?
Roberto Cialfi
Validation rule that excludes some roles
Hi, need a validation rule to make sure that if a case is new, it can be only created with the "New" Status. However, 3 roles must be able to save them anyway, even with a different status value set. I am trying the following validation rule but is not working [Error: Syntax error. Missing ')']
I hope you can help me. Thank you
AND(
ISNEW() && NOT( ISPICKVAL( Status, "New" ) )
OR(
$UserRole.Name <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.Name <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.Name <> "GRPUKHRPeopleServicesTier1Advisor" ) )
I hope you can help me. Thank you
AND(
ISNEW() && NOT( ISPICKVAL( Status, "New" ) )
OR(
$UserRole.Name <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.Name <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.Name <> "GRPUKHRPeopleServicesTier1Advisor" ) )
I see but in my example instead of using the OR condition I changed to AND and that should work. Are you sure that the names that you're using are correct?
Example:
GRP_UK_HR_HR_Customer_Services_Manager
This name is more likely to be the DeveloperName and not the Name (Label) of the role. If that is the case you should change your formula to:
AND(
ISNEW(),
NOT(ISPICKVAL( Status, "New" )),
AND (
$UserRole.DeveloperName <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.DeveloperName <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.DeveloperName <> "GRPUKHRPeopleServicesTier1Advisor"
)
)
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
All Answers
If I understood correctly, try this instead:
AND(
ISNEW(),
NOT(ISPICKVAL( Status, "New" )),
AND (
$UserRole.Name <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.Name <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.Name <> "GRPUKHRPeopleServicesTier1Advisor"
)
)
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
Hi Zuinglio,
No, It is not working.
Below is the explanation (borrowing everything from Steve Molis)
So for example if:
Moe has RoleName = X
Larry has RoleName = Y
Curly has RoleName = Z
Joe has RoleName = Q
And we want to block any other User with Role <> X, Y, Z from doing something. If your Formula uses Logic like this:
OR(
$UserRole.Name <> "X",
$UserRole.Name <> "Y",
$UserRole.Name <> "Z",
)
Joe is blocked because Q is <> X or Y or Z
great!
BUT...
Moe is also blocked because X is <> Y or Z
Larry is also blocked because Y is <> X or Z
Curly is also blocked because Z is <> X or Y
So now every User is blocked, not just the one's you want (and that's not so great)
I see but in my example instead of using the OR condition I changed to AND and that should work. Are you sure that the names that you're using are correct?
Example:
GRP_UK_HR_HR_Customer_Services_Manager
This name is more likely to be the DeveloperName and not the Name (Label) of the role. If that is the case you should change your formula to:
AND(
ISNEW(),
NOT(ISPICKVAL( Status, "New" )),
AND (
$UserRole.DeveloperName <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.DeveloperName <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.DeveloperName <> "GRPUKHRPeopleServicesTier1Advisor"
)
)
Hope to have helped!
Regards.
Don't forget to mark your thread as 'SOLVED' with the answer that best helps you.
So, the field called "Roel Names" in the screen is the "Developer name" and the field called "Label" in the screen is "Role Name". They could have tried to make it a little more confusing, just to waste more time :(
Thank you, This is now working!
You're welcome! I do agree that is confusing but I'm glad it worked!
Regards