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
gamer632gamer632 

IsPickval in conjunciton with $User.ProfileId=; syntax ok, results not.

Hello, we have a validation rule that works fine when we use it with one Profile parameter (see Version One).  But it breaks if we try to add more (see Version 2 or 3).

 

Anyone know why this is and how I can expand it's function?  Notice the first time I excluded ALL users that were not CSR's, the second I tried to excluded ALL users not CSRs, Mktg, etc etc, and I think I caused some kind of dual exclude because after that No one could save.  The third I switched to the idea of EQUALS certain profiles instead of NOT EQUAL TO in the first two.

 

Version one

OR(ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Pending"), ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Working"))
&&
$User.ProfileId <> "00e60000000a5pv"

Version 2

OR(ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Pending"), ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Working"))
&&
$User.ProfileId <> "00e60000000a5pv,00e60000000avPC,00e60000000avPR,00e60000000aNgk"


Version 3

ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Pending")
||
ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Working")
&&
$User.ProfileId = "00e60000000avP7,00e60000000avPC,00e60000000avPR,00e60000000aNgk"

00e60000000nvPC,00e60000000nvPR,00e60000000oNgk
Best Answer chosen by Admin (Salesforce Developers) 
flewellsflewells

Does this work?

 

OR(ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Pending"), ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Working"))
&&
$User.ProfileId <> "00e60000000a5pv"

&&

$User.ProfileId <> "00e60000000avPC"

&&

$User.ProfileId <> "00e60000000avPR"

&&

$User.ProfileId <> "00e60000000aNgk"

 

 

All Answers

flewellsflewells

Does this work?

 

OR(ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Pending"), ISPICKVAL(Opportunity.CSR_Processing_Status__c, "Working"))
&&
$User.ProfileId <> "00e60000000a5pv"

&&

$User.ProfileId <> "00e60000000avPC"

&&

$User.ProfileId <> "00e60000000avPR"

&&

$User.ProfileId <> "00e60000000aNgk"

 

 

This was selected as the best answer
gamer632gamer632

that's working, we're going to launch this monday, thanks!