I want to create a validation rule on a look up field based on role . There are two roles

  1. Member Member - is a member
  2. Member PA - is a pa to the member

lookup fields - REP_Customer_Representative__c (lookup to Account)

The requirement is when a "member member" creates a case and if the look up field is blank the validation rule should not fire as REP_Customer_Representative__c - is a member representing field

But when a "Member Pa" creates a case he/she should not leave the lookup field REP_Customer_Representative__c - blank

and this is what i came up with, but the validation rule is not getting fired

AND( ISBLANK(REP_Customer_Representative__c), 
$UserRole.Name = 'Member_PA' ) 
  • 1
    Could you please edit your question? It is hard to understand (at least for me :)) – Artur Kępczyński Feb 12 '14 at 18:15
  • i want to create a validation rule on a look up field based on role . – Developer Feb 13 '14 at 9:20
  • 1
    Are you sure that is the UserRole Name? It looks more like a Developer Name with the underscore. – Daniel Hoechst Apr 27 '15 at 16:44
  • Agreed. The Name should generally be the human-readable name: 'Member PA' – Jeremy Nottingham Apr 27 '15 at 18:26

I don't know if this is the answer, but try:

AND( ISBLANK(REP_Customer_Representative__r.Id), 
$UserRole.Name = 'Member_PA' ) 

I seem to recall the validation rules needing to look up a value on the parent (i.e. REP_Customer_Representative__r.Id), not just where there is a value in that field itself.

Let us know if this works... or not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.