0

I have validation rule on Account, there is a picklist channel.If the the picklist channel equals to Direct then no role can edit or create the Account record except the owner 'sales executive' role.i tried different sets of validation rules but none of them works, any help is appreciated.

AND(
     OR(
          ISNEW(),
          ISCHANGED( OwnerId )
     ),
    ISPICKVAL( Channel__c , 'Direct') ,
    Owner.UserRole.Id  <> '0051J0000053YAl'
)

Another:

AND(
     OR(
      ISNEW(),
      ISCHANGED( OwnerId )
     ),
      ISPICKVAL( Channel__c , 'Direct') ,
      $UserRole.Name <> "Sales Executive"
)

1 Answer 1

1

As per my understanding of your requirement, below should be your validation rule

AND(
      ISPICKVAL( Channel__c , "Direct") ,
      $UserRole.Name <> "Sales Executive"
)

This rule will now prevent any user's other than users with Sales Executive role to edit or create the record with Channel__c as Direct.

In the validation rule which you posted in the question, you were checking for the change of OwnerId, hence it will be fired only when a new record is created or only when the Owner of the record is changed i.e. it will still allow other user's to edit the record unless he/she is changing the Owner field.

3
  • Hi Vijay Ganji,
    – siri
    Commented Mar 7, 2019 at 9:55
  • Hi Vijay Ganji, I have tied what you suggested but the validation rule is not working all user are able to create and editing the account record. can u check once what is going wrong
    – siri
    Commented Mar 7, 2019 at 11:38
  • Hi @Siri, can you please confirm if your validation rule is active. Also, please check if you are logging in with the user whose role is not "Sales Executive" and Channel is selected as "Direct" i.e. check the picklist value. Commented Mar 7, 2019 at 13:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .