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
tmactmac 

Opportunity Validation Rule for Closed/Won Stage

I am working on another validation rule.  While no syntax errors appear I am still able to change the stage of the opportunity to Close Won without the required fields. 

 

In essence what I would like is for the following fields to be required when the opportunity stage equals Close Won.  I provided the field name in red.

1.    Primary Activity must be completed (this is a picklist value) Activity_c

2.    NAICS Code must be completed (this is a look up field) NAICS_Code_c

3.    # of Jobs must be completed (this is a number field) of_Jobs_c

4.    Amount of investment must be completed (this is a currency field) Amount

5.    The Account Name cannot be CONFIDENTAL (this is a look up text field) Account.Name

 

Currently I have the following validation rule active.  No syntax errors appear however, I don’t get the results I need.  I have omitted the investment and account name from this validation rule because when I include them I get errors.  It is as if it does not want to accept the field type in my validation rule.  Can someone please provide assistance?  I cant seem to understand what I am doing wrong here.

 

AND(
ISPICKVAL(StageName, "Close Won"),
OR(
ISPICKVAL( Activity__c , ""),
of_Jobs__c < 0,
LEN( NAICS_Code__c ) = 0
))

FreshFresh
I'm not sure if I have your solution, but off the bat i can see an issue with your "of_Jobs__c" statement. This shouldn't be looking to see if it is less than 0, but instead null or equal to 0. Secondly, for your NAICS Code I would recommend using the ISNULL function instead of the LEN function.

Aside from that I would need some more information to finish troubleshooting this. First of all, what is the error message you are receiving when you try to reference the Account Name and Investment? Second, are any of the fields causing the validation rule to work? For example, if you fill out the of_Jobs__c and NAICS_Code__c but don't fill in Activity__c does the error go up, or is it simply never being triggered?

I hope my input helps!
tmactmac
Actually I corrected my problem and found that I labeled the field wrong.  My formula now works.  However, I still can not get the Account Name to be confidential.
gregpgregp

I'm trying to do something similar. I need to create a rule that would not allow a Closed/Won Opportunity to be submitted without a renewal date (which is a custom field). 

 

What I have written is below, but it keeps popping this error. Error: Syntax error. Extra AND

IF(
ISPICKVAL(StageName, "Closed Won"))
AND(
ISNULL(Renewal_Date__c))

Any thoughts?