+ Start a Discussion
KimberlyJKimberlyJ 

Validation Rule Help Please

Hello. We have Professional Edition.  Trying to create an error when an opportunity stage is dead that you have to pick a reason why from a picklist.  That part I got... now trying to limit it to 2 departments which is another picklist.  Can't seem to get it to work.

This validation rule works as is. Does not limit department. Only requires we pick from reason lost/dead picklist if opportunity stage is dead/lost.
AND (
  OR (
     ISPICKVAL( StageName, "Closed Lost"),
     ISPICKVAL( StageName, "Dead")),
ISPICKVAL(  Reason_Lost_or_Dead_2__c , ""))

Tried adding department picklist to this and it doesn't work the way it should.  Networks and Distribution need to follow the validation rule, the others don't need to worry about it.  It's times like this I wish I had Enterprise. 
AND(
   ISPICKVAL(  Reason_Lost_or_Dead_2__c , ""),
AND(
OR(
  ISPICKVAL( CCI_Division_Region__c ,"CCI Networks"),
  ISPICKVAL( CCI_Division_Region__c ,"CCI Distribution"),
AND(
OR (
     ISPICKVAL( StageName, "Closed Lost")),
     ISPICKVAL( StageName, "Dead")))))

Any assistance is appreciated. Thank you.
Best Answer chosen by KimberlyJ
Phillip SouthernPhillip Southern
Hey Kimberly, so are you trying to further restrict this rule to only run when the division region is either networks or distribution?  If so you can write it like this:

AND (
  OR (
     ISPICKVAL( StageName, "Closed Lost"),
     ISPICKVAL( StageName, "Dead")),
ISPICKVAL(  Reason_Lost_or_Dead_2__c , ""),
OR(
  ISPICKVAL( CCI_Division_Region__c ,"CCI Networks"),
  ISPICKVAL( CCI_Division_Region__c ,"CCI Distribution"))
)

All Answers

Phillip SouthernPhillip Southern
Hey Kimberly, so are you trying to further restrict this rule to only run when the division region is either networks or distribution?  If so you can write it like this:

AND (
  OR (
     ISPICKVAL( StageName, "Closed Lost"),
     ISPICKVAL( StageName, "Dead")),
ISPICKVAL(  Reason_Lost_or_Dead_2__c , ""),
OR(
  ISPICKVAL( CCI_Division_Region__c ,"CCI Networks"),
  ISPICKVAL( CCI_Division_Region__c ,"CCI Distribution"))
)
This was selected as the best answer
Ashish_SFDCAshish_SFDC
Hi Kimberly, 


You can also Use Case() Function to check if the Value meets the criteria. 

Example: https://success.salesforce.com/answers?id=90630000000gtcCAAQ


Regards,
Ashish
Ashish_SFDCAshish_SFDC
Hi Kimberly,


You can also Use Case() Function to check if the Value meets the criteria.

Example: https://success.salesforce.com/answers?id=90630000000gtcCAAQ

Formula:
AND (
  CASE( StageName,
     "Value Proposition", 1,
     "Id. Decision Makers", 1,
     "Perception Analysis", 1,
     "Proposal/Price Quote", 1,
     "Negotiation/Review", 1,
     "Closed Won", 1,
     0) = 1,
  NOT(HasOpportunityLineItem)
)

https://help.salesforce.com/HTViewHelpDoc?id=fields_useful_field_validation_formulas.htm


Regards,
Ashish