1

I have a address object, where I have to give a validation rule for one field name sequence ID

Requirement is : when sequence ID is assigned no user cannot edit other fields except one user [email protected] and 3 profile(system admin, system admin1, system admin2)

I wrote the rule but when I exempt those user and profile, they are not exempting means they cannot even edit other fields along with sequence ID.

AND(
    NOT(ISBLANK(Sequence_ID__c)),
    $User.Username <> '[email protected]',
    OR(
       NOT( $Profile.Name = "system admin1"),
       NOT( $Profile.Name = "system admin2"),
       NOT( $Profile.Name = "system admin3")
    )
)

1 Answer 1

1

no user cannot edit other fields except one user [email protected] and 3 profile(system admin, system admin1, system admin2)

So, between user and profile comparison, you need to put AND instead of OR

AND(
    NOT(ISBLANK(Sequence_ID__c)),
    $User.Username <> '[email protected]',
    NOT( $Profile.Name = "system admin1"),
    NOT( $Profile.Name = "system admin2"),
    NOT( $Profile.Name = "system admin3")
)

You can use like this way too

NOT(ISBLANK(Sequence_ID__c) 
&& ($User.Username <> '[email protected]' 
    && ($Profile.Name <> "system admin1" 
    && $Profile.Name <> "system admin2"
    && $Profile.Name <> "system admin3"
    )
)
3
  • 1
    You can just remove that second AND. Or the parens wrapping the $Profile clauses in your second approach. Redundant.
    – Adrian Larson
    Apr 7, 2017 at 16:05
  • Thank you all, I have just figure it out like this : AND( NOT(ISBLANK(Sequence_ID__c)), NOT(OR( $User.Username <> '[email protected]', $Profile.Name = "system admin1", $Profile.Name = "system admin2", $Profile.Name = "system admin3" ) ) )
    – SFlast
    Apr 7, 2017 at 16:09
  • @SFlast if my answer solves your issue then accept this, so that others may find this useful. Apr 20, 2017 at 2:53

You must log in to answer this question.

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