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
alvatsealvatse 

Validation Rule: check if Lost To is filled in

I'm trying to build a validation rule that checks if a Lookup field 'Lost To Account' is filled in when an Opportunity is in Stage = Closed Lost. There is no syntax error but it's not prompting error message when I change an Opp. to Closed Lost and do not fill in Lost To Account field:

 

AND(ISPICKVAL(StageName,"Closed Lost" ),
$RecordType.Id = "012000000008WTHAA2" ,
NOT(ISPICKVAL(Type, "Accounting Adjustment" )),

NOT(ISPICKVAL(Type, "New Partner" )),
NOT(ISPICKVAL(Type, "Partner (Agency)" )),
NOT(ISPICKVAL(Type, "Partner (Technology/OEM)" )),
NOT(ISPICKVAL(Type, "Patner (Integration/Referral)" )),
( $User.FirstName = "xxx" ),
ISNULL(Lost_To_Account__r.Name))

Message Edited by alvatse on 07-27-2009 01:33 PM
Message Edited by alvatse on 07-27-2009 01:34 PM
Message Edited by alvatse on 07-27-2009 01:35 PM
Best Answer chosen by Admin (Salesforce Developers) 
Steve :-/Steve :-/

I implemented a similar thing on our SFDC.Org (albeit more stripped down)  anyway, here's my code.

 

If the Opportunity.Stage  = Lost then the user is required to specify a Loss Reason (related picklist).  If they sepcify that it was lost to a  Competitor, then they have to select the Competitor Account.

 

 

AND (LEN( Lost_To__c ) < 1, ISPICKVAL( Loss_Reason__c ,"Competitor"))

 

 

 

All Answers

Steve :-/Steve :-/

I implemented a similar thing on our SFDC.Org (albeit more stripped down)  anyway, here's my code.

 

If the Opportunity.Stage  = Lost then the user is required to specify a Loss Reason (related picklist).  If they sepcify that it was lost to a  Competitor, then they have to select the Competitor Account.

 

 

AND (LEN( Lost_To__c ) < 1, ISPICKVAL( Loss_Reason__c ,"Competitor"))

 

 

 

This was selected as the best answer
alvatsealvatse
thanks for the suggestion on the LEN function. It worked!