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
DinuDinu 

validation rule based on role is not working

Hello All,

I am writting a validation rule on a field "Company" of user object. My criteria is if user's role is begins with "Cust" then "Company" name can not be "Test1" and "test2". Below code is not working.
 
NOT(AND(
	BEGINS($UserRole.Name, "Cust"),
	OR(UPPER(Company) = "Test1",
      UPPER(Company) = "test2")
	)
)

 
Best Answer chosen by Dinu
DinuDinu
it worked after removing $

All Answers

OFröhlichOFröhlich
Hi,

you should delete the NOT. Raise the Message when (User Role starts with Cust) and (Company equals Test1 or  Company equals Test2) is true.

If this helps, please mark as Best Answer to help others too.

Oliver
DinuDinu
it worked after removing $
This was selected as the best answer