1

We have a specific user that can edit Account records (use has full CRED to Account object as well as edit permissions at the field level) we want to restrict them from editing the standard field "Type" when it is NOT = Prospect or Competitor AND only be able to edit it to = "Prospect" or "Competitor".

There are 33 other values in the picklist they should not be able edit from or to select.

We want the user to experience an error if they attempt to edit/us any other values in the Type field.

I am doing this at the user level, as there is only 1 user of the same profile this will affect.

We have only 1 record type on the Account (we do not want to introduce other record types).

I have attempted this with a validation rule (which passes syntax but does not work):

AND(
$User.User_18_Digit_ID__c <> "00550000003Ohx5BAG",
ISCHANGED(Type),
OR (
ISPICKVAL (PRIORVALUE (Type), "Prospect"),
ISPICKVAL (PRIORVALUE (Type), "Competitor")
))

When I log in as the user to test, it will allow me to edit Accounts that are not Type = "Prospect" or "Competitor" (which it should not) And it will allow me to select a Picklist value for Type field that is not "Prospect" or Competitor"

I appreciate any suggestions.

2
  • 3
    When you have a complex formula, you're best to break down the problem into smaller pieces. First create logic that stops them being able to edit it when it isn't one of those values currently, then create logic that stops them changing it to new values. Once each piece works, then combine it. Otherwise you have no idea which part of it isn't working
    – Nick Cook
    Jan 20 at 0:48
  • The user should not be change the type values to other pick list values other than Prospect and Competitor. Is this the requirement? Jan 20 at 2:39

1 Answer 1

0
"when it is NOT Prospect or Competitor AND only be able to edit it to = "Prospect" or "Competitor". 

Doesn't make sense at all. If you have a Validation Rule (VR) to prevent edit when picklist value is NOT Prospect or Competitor, then how are you able to edit to "Prospect" or "Competitor" at all?

Your VR logic can be simplified to just :

only be able to edit Type field value to "Prospect" or "Competitor" only

So the VR should be written this way.

AND(
   CONTAINS($User.Email, "<Email address>",
   ISCHANGED(Type),
   NOT(ISPICKVAL (Type, "Prospect")),
   NOT(ISPICKVAL (Type, "Competitor")),
)

Also, your validation rule should not hard code the user's ID because when you deploy from Sandbox to Production it may be a different unique salesforce id. So you should use user's email instead.

1
  • thank you for your input. The profile in question only works with Prospects and Competitor Accounts. with only one user ID,
    – B Leahy
    Jan 20 at 13:40

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.