function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Eric Chan 50Eric Chan 50 

Validation Rule - Disable Certain Picklist Value for a Sales Profile on Record Type

Can anyone let me know if im doing this correctly?

Need a validation rule that prevents a Sales user from updating a picklist to a Certain Value on a Certain Record Type.

For this excample, i want to prevent Sales User from updating picklist to Value1 (and allow all other values for them) for that record type

(AND( $User.ProfileId <> "Sales User",,$RecordType.Name = "Record Type Name",
ISCHANGED(Status__c),
NOT(ISPICKVAL(Status__c, 'Value2')),
NOT(ISPICKVAL(Status__c, 'Value3')),
NOT(ISPICKVAL(Status__c, 'Value4')),
)
)
Best Answer chosen by Eric Chan 50
Maharajan CMaharajan C
Hi Chan,

AND( 
  $Profile.Name="Sales User"
  $RecordType.Name == "Record Type Name",
  ISCHANGED(Status__c),
  ISPICKVAL(Status__c, 'Value1')
)

Thanks,
Maharajan.C

 

All Answers

Andrew GAndrew G
Hi Eric

First question that jumps to mind - is this the Opportunity object, if so, would Sales Processes solve your issue.

Second question - if the user is not a "Sales Users", should they be able to select "Value1"  ?

Lastly, to answer the question, your validation will fire if the outcome is TRUE, so try something like:
 
AND( 
  $User.ProfileId <> "Sales User",
  $RecordType.Name == "Record Type Name",
  ISCHANGED(Status__c),
  ISPICKVAL(Status__c, 'Value1')
)

Regards
Andrew
Maharajan CMaharajan C
Hi Chan,

AND( 
  $Profile.Name="Sales User"
  $RecordType.Name == "Record Type Name",
  ISCHANGED(Status__c),
  ISPICKVAL(Status__c, 'Value1')
)

Thanks,
Maharajan.C

 
This was selected as the best answer
Eric Chan 50Eric Chan 50
Thank you both! I believe this will work!
Lewis LindaLewis Linda
If you want the functionality without using record types, you can create a VF component and embed it on your object's page layout and populate the picklist values based on profile in controller extension https://www.upsers.club/