I can't seem to get my validation rule to work.
I need a Validation rule on user detail record to make phone number field required but only for certain profiles. I need the number to be in the format for UK numbers e.g 0207 456 7689 - must be 11 digit long and only required for anyone with any of the following profiles user detail record:
Profile Name = Sales Agent,
Profile Name = Field Sales Agent,
Profile Name = Field Service Agent,
Profile Name = Lead Gen Agent,
Profile Name = Leade Gen Team Leader/Manager,
Profile Name = Sales Team Leader/Manager
Profile Name = TEL Sales Agent,
Profile Name = THS Sales Agent
Any other profiles e.g system admin or standard user would be able to save the user detail record without phone number filed required.
I have tried this:
AND(
ISBLANK(Phone)
Profile.Name = "Sales Agent",
OR(Profile.Name = ‘Field Sales Agent’),
OR(Profile.Name = ‘Field Service Agent’),
OR(Profile.Name = ‘Lead Gen Agent’),
OR(Profile.Name = ‘Lead Gen Team Leader/Manager’),
OR(Profile.Name = ‘Sales Team Leader/Manager’),
OR(Profile.Name = ‘TEL Sales Agent’),
OR(Profile.Name = ‘THS Sales Agent’)
)
)
Appreciate the help.
Thanks
Hi, Thanks @Moonpie and @Caspar Harmer - that worked, appreciate it. I just now need to make sure the phone number always starts with 0 and is no more than 11 digits long as standard. This is what I have so far which hasn't worked:
AND(
ISBLANK(Phone),
!REGEX(Phone, "^(0)[1-9]{1}([0-9]{8,9})$"),
Phone != 'unknown',
OR (Profile.Name = "Sales Agent",
Profile.Name = "Field Sales Agent",
Profile.Name = "Field Service Agent",
Profile.Name = "Lead Gen Agent",
Profile.Name = "Lead Gen Team Leader/Manager",
Profile.Name = "Sales Team Leader/Manager",
Profile.Name = "TEL Sales Agent",
Profile.Name = "THS Sales Agent")
)
Would appreciate the help.
Thanks
,
(comma) afterISBLANK(Phone)
.