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
Local EdgeLocal Edge 

HELP with validation rule frustration

I am attempting to write a code that forces a user to enter info into a test field when a specific picklist value is selected. Where my frustration lies is that I have a basically identical rule for my Leads page that works fine and when I duplicated it into my Opportunites page it doesn't.
 
Code:
 
AND (  
 OR(
ISPICKVAL( StageName , "Closed Lost" )),
ISNULL( Closed_Lost_Reason__c )
)
 
 
I also tried this code to no avail:
 
Code:
and(
    ispickval(StageName , "Closed Lost")
   ,isnull(Closed_Lost_Reason__c)
)
Could someone please help?
Best Answer chosen by Admin (Salesforce Developers) 
BuellBuell
What type of field is your custom Closed Lost Reason?
 
If it is a picklist:
 
AND(
ISPICKVAL( Closed_Lost_Reason__c, ""),
ISPICKVAL( StageName, "Closed Lost" )
)
 
 
If it is a text field:
 
AND(
LEN( Closed_Lost_Reason__c ) = 0,
ISPICKVAL( StageName, "Closed Lost" )
)

All Answers

BuellBuell
What type of field is your custom Closed Lost Reason?
 
If it is a picklist:
 
AND(
ISPICKVAL( Closed_Lost_Reason__c, ""),
ISPICKVAL( StageName, "Closed Lost" )
)
 
 
If it is a text field:
 
AND(
LEN( Closed_Lost_Reason__c ) = 0,
ISPICKVAL( StageName, "Closed Lost" )
)
This was selected as the best answer
Local EdgeLocal Edge
It is a text field and this work great. THANKS!