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
Kellyrl77Kellyrl77 

ISPICKVAL

I am trying to prevent only certain users from choosing Closed Won or Closed Ordered.  I am new at this and the syntax is a little confusing.  The reason I am using the alias field is simply because Roles and Profiles cross over divisions and we have several folks with the same last names.  Please help. Is there a better way to get this to work?


 

OR(
(ISPICKVAL(StageName, "Prospecting"),
(ISPICKVAL(StageName, "Qualifying"),
(ISPICKVAL(StageName, "Solution Proposed"),

(ISPICKVAL(StageName, "Proposal Submitted"),

(ISPICKVAL(StageName, "Recommended"),

(ISPICKVAL(StageName, "Approved"),

( $User.Alias, "ealba"), 
( $User.Alias, "DWard"), 
( $User.Alias, "PTatt"),
( $User.Alias, "TScir"),
( $User.Alias, "DKapp"),
( $User.Alias, "DHillNMI"),
( $User.Alias, "MCasa"),
( $User.Alias, "SColl"))
)

Best Answer chosen by Admin (Salesforce Developers) 
Eugene NeimanEugene Neiman

I did that from my iPhone!  Sorry.  I will stick with you until we have this.  This validates for me:

 

AND (
OR ( ISPICKVAL(StageName, "Closed Won"),ISPICKVAL(StageName, "Closed Ordered")),
OR ( $User.Alias = "ealba", $User.Alias = "DWard", $User.Alias = "PTatt", $User.Alias = "TScir", $User.Alias = "DKapp", $User.Alias = "DHillNMI",$User.Alias = "MCasa", $User.Alias = "SColl")
)

All Answers

Eugene NeimanEugene Neiman

If you are trying to prevent these users you can try the following.  It would be better to group them by profile or role and then reduce this to $User.Profile for No Close Users.

 

AND (
OR (
(ISPICKVAL(StageName, "Closed Won"),
(ISPICKVAL(StageName, "Closed Ordered"))
OR (
( $User.Alias, "ealba"),
( $User.Alias, "DWard"),
( $User.Alias, "PTatt"),
( $User.Alias, "TScir"),
( $User.Alias, "DKapp"),
( $User.Alias, "DHillNMI"),
( $User.Alias, "MCasa"),
( $User.Alias, "SColl")))

Kellyrl77Kellyrl77

Profile ID is not possible, as there are several in the same profiel that need the function.  I tried the sytax you provided but I received the error below; I tried using Role ID and I am getting the same error, "Syntax error.  Missing ')' - highlighting the comma after "Closed-Won),    -   I have tried several scenarios, but still not getting it.  Help please.

 

AND (

OR (

(ISPICKVAL(StageName, "Closed-Won"),

(ISPICKVAL(StageName, "Closed-Ordered"))

OR (

( $UserRole.Id, 00E40000007Axy1),

( $UserRole.Id, 00E40000007Axxs),

( $UserRole.Id, 00E40000007Axxr),

( $UserRole.Id, 00E40000007Axxw),

( $UserRole.Id, 00E40000007Axz4),

( $UserRole.Id, 00E40000007A37e),

( $UserRole.Id, 00E40000007ayeg)))

Eugene NeimanEugene Neiman

(ISPICKVAL(StageName, "Closed-Won"),
Should be

ISPICKVAL(StageName, "Closed-Won"),
I think. Removed first "("
Kellyrl77Kellyrl77

Sorry to be such a pain.  Now I am getting the following error:

 

 Error: Syntax error. Missing ')' in front of the second OR (

Eugene NeimanEugene Neiman

I did that from my iPhone!  Sorry.  I will stick with you until we have this.  This validates for me:

 

AND (
OR ( ISPICKVAL(StageName, "Closed Won"),ISPICKVAL(StageName, "Closed Ordered")),
OR ( $User.Alias = "ealba", $User.Alias = "DWard", $User.Alias = "PTatt", $User.Alias = "TScir", $User.Alias = "DKapp", $User.Alias = "DHillNMI",$User.Alias = "MCasa", $User.Alias = "SColl")
)

This was selected as the best answer
Kellyrl77Kellyrl77

It worked!  Thank you, thank you, thank you!!!!!  I really appreciate it!