2

I have a validation rule: When the stage name is changed to "4. Proposal" then the max discount should be > 5 and Special_Pricing_Approved should be = false.

My validation rule:

IF((ISPICKVAL(StageName , "4. Proposal")),
And(Max_Discount__c < 5, Special_Pricing_Approved__c == true),null)

Is this the correct rule as per my requirement? This validation gets fired when max discount > 5 or < 5 same with pecial_Pricing_Approved get fire if it is true or false. What is wrong with my validation rule?

Error from debug:

VALIDATION_RULE|Opportunity_to_Proposal
|VALIDATION_FORMULA|AND(
ISPICKVAL(StageName , "4. Proposal")
,
OR(Max_Discount__c <= 5
   ,
   Special_Pricing_Approved__c = true
)
)|Max_Discount__c=21.05 , StageName=4. Proposal , Special_Pricing_Approved__c=0
VALIDATION_FAIL
2

A validation rule should contain the conditions for failure. So if the stage is 4, and either max_discount is <5 or special_pricing_approved is true, then an error message should be shown. So you formula should probably be:

AND(
   ISPICKVAL(StageName , "4. Proposal"),
   OR(
      Max_Discount__c <= 5,
      Special_Pricing_Approved__c = true
   )
)
  • @Rahul Take note to how writing a formula like this, makes it more readable and easier to understand. This helps to spot mistakes. – Samuel De Rycke Apr 21 '15 at 9:09
  • @guy I am still getting the same issue. Have updated my question with error I am getting on debug. – RAHUL SRIVASTAVA Apr 21 '15 at 9:10
  • you said "when stage name is changed to "4. Proposal" then the max discount should be > 5 and Special_Pricing_Approved should be = false". Both are true in this case so there is not supposed to be an error, right? Or do you mean something else? – Guy Clairbois Apr 21 '15 at 9:38
  • @guy he mean the user should be able to change the stage to "4. Proposal" if max discount > 5 and Special_Pricing_Approved = false. If any of them do not certify the through an error. ie:- max discount < 5 OR Special_Pricing_Approved = true then fire the validation rule. else dont do anything. allow them to change. – Anu Apr 21 '15 at 9:55
  • @Anu that is what my answer does indeed. – Guy Clairbois Apr 21 '15 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.