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
Phillip Moseley 2Phillip Moseley 2 

Have a Validation Rule that's not giving any syntax errors, but it's not working

I have the following validation rule that's not giving any syntax errors, but it's not working. I'm trying to require the Demo Used field if Stage equals one the three values below, the Primary Partner Involved field is not blank, plus only make it required for the three Profiles below. If anyone could let me know how to tweak this to get it to work correctly, that would be great. Thanks.

AND(
OR($Profile.Name = "Jaggaer Sales Partner Group",
$Profile.Name = "Jaggaer Sales",$Profile.Name = "Sales Salesforce Super User"),
ISPICKVAL(StageName, "Closed/Won"),
ISPICKVAL(StageName, "Closed/Lost"),
ISPICKVAL(StageName, "Closed - Lost to Competition"),
OR(
Primary_Partner_Involved__c <> ""),
ISBLANK(TEXT(Demo_Used__c)
))
Best Answer chosen by Phillip Moseley 2
AnkaiahAnkaiah (Salesforce Developers) 
Hi Phillip,

Try with below.
AND(
OR($Profile.Name = "Jaggaer Sales Partner Group",
$Profile.Name = "Jaggaer Sales",$Profile.Name = "Sales Salesforce Super User"),
OR(Text(StageName)="Closed/Won",
Text(StageName)= "Closed/Lost",
Text(StageName)= "Closed - Lost to Competition"),
OR(
ISBLANK(Primary_Partner_Involved__c),
ISBLANK(Demo_Used__c)))

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​

All Answers

AnkaiahAnkaiah (Salesforce Developers) 
Hi Phillip,

Try with below.
AND(
OR($Profile.Name = "Jaggaer Sales Partner Group",
$Profile.Name = "Jaggaer Sales",$Profile.Name = "Sales Salesforce Super User"),
OR(Text(StageName)="Closed/Won",
Text(StageName)= "Closed/Lost",
Text(StageName)= "Closed - Lost to Competition"),
OR(
ISBLANK(Primary_Partner_Involved__c),
ISBLANK(Demo_Used__c)))

If this helps, Please mark it as best answer.

Thanks!!​​​​​​​
This was selected as the best answer
Phillip Moseley 2Phillip Moseley 2
Hi Ankaiah, I appreciate your help with this one. This did work. I had to make two minor tweaks listed below for last two lines. One is a picklist field so just had to add Text. This was very helpful and helped me get it resolved and is now working. 
Primary_Partner_Involved__c <> ""),
ISBLANK(TEXT(Demo_Used__c)))