You need to sign in to do that
Don't have an account?
Sabrent
Validation rule to conditionally make a lookup field required
I have a field called IT Executive Team of data type lookup on users.
I want to create a validation rule to make it a required field for all users who are not in a particular role.
Any pointers will be greatly appreciated. Thanks in advance
Worked out the solution -
IF(
AND(
NOT CONTAINS($UserRole.Name ,"IT Management"),
ISBLANK(IT_Executive_Team__c)
),
true,
false
)
All Answers
You can add a Validation rule to it;
eg:
ISBLANK( lookupfieldname__c )
I tired it just now to make sure this works and it did work.
ISBLANK( lookupfieldname__c ) makes it required for all users.
I want to make it required only for some users.
E.g The lookup field can be blank if a $UserRole.Name = 'Manager' Else Required field.
Worked out the solution -
IF(
AND(
NOT CONTAINS($UserRole.Name ,"IT Management"),
ISBLANK(IT_Executive_Team__c)
),
true,
false
)
try this , please add your lookup field api name and role names in Or condition , you can write as many in role separating with ,
Thanks Shashikant!! This is how I did, it worked. Please advise if you think this is not a viable option.
IF(
AND(
NOT CONTAINS($UserRole.Name ,"IT Management"),
ISBLANK(IT_Executive_Team__c)
),
true,
false
)
I would suggest you to change it to this
Why i used <> ( this means Not equals to) instead of Contains is that if any some new Role comes like this in future
IT Management Company or IT Management Reporting they will also by pass your validation. Even though it is kind of thinking for future scenario. Up to you now.
Thanks heaps!! Much appreciated.