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
CarrieLeeCarrieLee 

Fields Required only after Closed Won stage selected

I created a section in the "Opportunity" tab called Order Book. I would like to require certain fields in this section to be *required only when we change the stage of the Opportunity to Closed Won. I'm not sure where to start with this......
Gemini@WorkGemini@Work
Have you looked at Validation rules in the online  "Help & Training" ?
CarrieLeeCarrieLee
I saw your post to someone else in regard to creating a Validation Rule, so I am going to read more about it. I'm not good at writing formulas so I may post back for help.
CarrieLeeCarrieLee
IF(ISPICKVAL (StageName, "ClosedWon"),
ISNULL(Radiology_Manager__c)
 
 
Error: Syntax error. Missing ')'
 
I hate that error!!
 
Any suggestions?
Gemini@WorkGemini@Work
I don't think you want to use an IF statement here.  I think, based on your past posts, what you're going after is something like this:
 
Code:
AND ( 
    ISPICKVAL( StageName, "Closed Won"), 
    ISNULL( Radiology_Manager__c )
)

 
CarrieLeeCarrieLee
That code works, thank you, I'm getting closer. The goal of this formula is to *require our reps to fill in the Radiology Manager's name when they close a sale (select Closed Won). So if they tried to close a sale by selecting Closed Won and then hitting "Save" they would receive an error that say's "Please complete the required fields in the Order Book section". The fields are only required at the Closed Won stage.
 
Any thoughts or ideas?
Gemini@WorkGemini@Work
So what's missing?  You've got the formula, and you know the error message that you want to display when the formula equates to true.  Did you try creating this as a Validation Rule under the Opportunity standard object?
CarrieLeeCarrieLee
I'm not sure I activated the rule and saved it and it doesn't prompt the Radiology Manager field to be required when I save the Opportunity as Closed Won.
NPMNPM

Of course you will need to Save and Activate the rule for it to evaluate the conditions when you try to save the record.

But, another item to think about:  what type of field is Radiology_Manager__c?  If it is a text type ISNULL will not work (this is noted inthe Help and Training desription of ISNULL.  For text type fields we need to use the LEN() function.  To check for what we think of as null for text fields (Text fields are never null just empty :smileywink:) use LEN(Radiology_Manager__c)=0

HTH

Code:
AND ( 
    ISPICKVAL( StageName, "Closed Won"), 
    LEN( Radiology_Manager__c )=0
)

 
CarrieLeeCarrieLee
You are correct. Radiology Manager is a text field so the formula you provided is correct and ISNULL only made it so that when a new Opportunity was created the stage was defaulted to Closed Won, go figure that one. Thank you!
CarrieLeeCarrieLee
I hate this Syntax error. The goal of the validation rule is to require the sales rep to select a "Construction Type" when the stage of the Opportunity is Closed Won.
 
AND (
ISPICKVAL( StageName, "Closed Won"),
IF (ISPICKVAL ( Construction_Type__c ,
"Existing Room",
"Remodel",
"New Construction",
" New Construction & Remodel",
"Mobile",
)
Error: Syntax error. Missing ')'
 
Any ideas?
NPMNPM
For this new validation formula If your goal is to require something to be selected in the picklist rather than no selection see the post below from Gemini@Work  8/1/08.