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
Peter Reid 12Peter Reid 12 

Validation Rule Needs minor tweaking, but can't figure out what

Hi everyone, I'm stuck on this/have tried it many ways but can't get to work
I want this to say, "If users profile = ...., and any of these Stages are selected....then the following fields are required" So I have the profile id and the four stage at the top part of this, then on the bottom half  (separated by the spaces) are the required fields.  What am I missing here?  Right now no matter what stage I select, the rule fires,

AND( 
OR( 
$User.ProfileId = "00e4A000000gBHU", 
ISPICKVAL(StageName, "Proposal/Price Quote"), 
ISPICKVAL(StageName, "Finance Review"), 
ISPICKVAL(StageName, "Close Won"), 
ISPICKVAL(StageName, "Close Lost"), 


ISPICKVAL(Primary_Processor__c,""), 
ISPICKVAL(X2nd_Processor__c,""), 
ISPICKVAL(X3rd_Processor__c,""), 
ISBLANK(Existing_Portfolio_Total_MIDs__c), 
ISBLANK(X1st_Year_MIDs__c), 
ISBLANK(X2nd_Year_MIDs__c), 
ISBLANK(X3rd_Year_MIDs__c), 
ISBLANK(X1st_Year_Net_Revenue__c), 
ISBLANK(X2nd_Year_Net_Revenue__c), 
ISBLANK(X3rd_Year_Net_Revenue__c), 
ISBLANK(Gross_Margin_per_MID__c), 
ISBLANK(Current_Sales_Model__c), 
ISBLANK(Number_of_Active_Agents__c), 
ISPICKVAL(Proposed_Revenue_Share__c,""), 
ISBLANK(Proposed_Basis_Points__c), 
ISBLANK(Proposed_Transaction_Cost__c)))
Steven NsubugaSteven Nsubuga
Try this
AND( 
$User.ProfileId = "00e4A000000gBHU",

OR( 
 
ISPICKVAL(StageName, "Proposal/Price Quote"), 
ISPICKVAL(StageName, "Finance Review"), 
ISPICKVAL(StageName, "Close Won"), 
ISPICKVAL(StageName, "Close Lost")), 

OR(

ISBLANK(Primary_Processor__c), 
ISBLANK(X2nd_Processor__c), 
ISBLANK(X3rd_Processor__c), 
ISBLANK(Existing_Portfolio_Total_MIDs__c), 
ISBLANK(X1st_Year_MIDs__c), 
ISBLANK(X2nd_Year_MIDs__c), 
ISBLANK(X3rd_Year_MIDs__c), 
ISBLANK(X1st_Year_Net_Revenue__c), 
ISBLANK(X2nd_Year_Net_Revenue__c), 
ISBLANK(X3rd_Year_Net_Revenue__c), 
ISBLANK(Gross_Margin_per_MID__c), 
ISBLANK(Current_Sales_Model__c), 
ISBLANK(Number_of_Active_Agents__c), 
ISBLANK(Proposed_Revenue_Share__c), 
ISBLANK(Proposed_Basis_Points__c), 
ISBLANK(Proposed_Transaction_Cost__c)))

 
Peter Reid 12Peter Reid 12
Hey Steven - I think that might be part of my issue; the first three fields list in the required portion are picklist fields, so if I put ISBLANK then it fires an errors

ISPICKVAL(Primary_Processor__c,""), 
ISPICKVAL(X2nd_Processor__c,""), 
ISPICKVAL(X3rd_Processor__c,""), 

Those are the three culprits.  Any idea on how to handle that?
Error: Field Primary_Processor__c is a picklist field. Picklist fields are only supported in certain functions.

Thanks again for any help!
Steven NsubugaSteven Nsubuga
Try using ISNULL, rather than ISBLANK for the picklists.
Peter Reid 12Peter Reid 12
Hey Steven, I had initially tried that when I was playing around with this but no luck.  I just plugged in again to be sure 
ISNULL(Primary_Processor__c,""), 
ISNULL(X2nd_Processor__c,""), 
ISNULL(X3rd_Processor__c,""), 

And I receive the same error.  Does something look off on what I am doing there^

Error: Field Primary_Processor__c is a picklist field. Picklist fields are only supported in certain functions.
 
Steven NsubugaSteven Nsubuga
See proposed solution below:
AND( 
$User.ProfileId = "00e4A000000gBHU",

OR( 
 
ISPICKVAL(StageName, "Proposal/Price Quote"), 
ISPICKVAL(StageName, "Finance Review"), 
ISPICKVAL(StageName, "Close Won"), 
ISPICKVAL(StageName, "Close Lost")), 

OR(

ISNULL(Primary_Processor__c), 
ISNULL(X2nd_Processor__c), 
ISNULL(X3rd_Processor__c), 
ISBLANK(Existing_Portfolio_Total_MIDs__c), 
ISBLANK(X1st_Year_MIDs__c), 
ISBLANK(X2nd_Year_MIDs__c), 
ISBLANK(X3rd_Year_MIDs__c), 
ISBLANK(X1st_Year_Net_Revenue__c), 
ISBLANK(X2nd_Year_Net_Revenue__c), 
ISBLANK(X3rd_Year_Net_Revenue__c), 
ISBLANK(Gross_Margin_per_MID__c), 
ISBLANK(Current_Sales_Model__c), 
ISBLANK(Number_of_Active_Agents__c), 
ISBLANK(Proposed_Revenue_Share__c), 
ISBLANK(Proposed_Basis_Points__c), 
ISBLANK(Proposed_Transaction_Cost__c)))
ISNULL only takes 1 parameter.
 
Peter Reid 12Peter Reid 12
Looks like we are still getting the same error- I've been trying to click the help articles or the "Tell More" but nothing identifies the problem!  Something wiht the picklist field isn't playing well
Steven NsubugaSteven Nsubuga
Seems you had the right idea with ISPICKVAL. My apologies.
So your initial issue was that the rule always fired for all stages yet you needed it to only fire for 4 stages you listed, correct?
Steven NsubugaSteven Nsubuga
AND( 
$User.ProfileId = "00e4A000000gBHU",

OR( 
 
ISPICKVAL(StageName, "Proposal/Price Quote"), 
ISPICKVAL(StageName, "Finance Review"), 
ISPICKVAL(StageName, "Close Won"), 
ISPICKVAL(StageName, "Close Lost")), 

OR(

ISPICKVAL(Primary_Processor__c, ""), 
ISPICKVAL(X2nd_Processor__c, ""), 
ISPICKVAL(X3rd_Processor__c, ""), 
ISBLANK(Existing_Portfolio_Total_MIDs__c), 
ISBLANK(X1st_Year_MIDs__c), 
ISBLANK(X2nd_Year_MIDs__c), 
ISBLANK(X3rd_Year_MIDs__c), 
ISBLANK(X1st_Year_Net_Revenue__c), 
ISBLANK(X2nd_Year_Net_Revenue__c), 
ISBLANK(X3rd_Year_Net_Revenue__c), 
ISBLANK(Gross_Margin_per_MID__c), 
ISBLANK(Current_Sales_Model__c), 
ISBLANK(Number_of_Active_Agents__c), 
ISBLANK(Proposed_Revenue_Share__c), 
ISBLANK(Proposed_Basis_Points__c), 
ISBLANK(Proposed_Transaction_Cost__c)))