Validation Rule Help Required - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Balaji SundarBalaji Sundar 

Validation Rule Help Required

Request for help in creating validation rule

Two Checkboxes and one percentage field

Percentage cant be lower than 30 if Checkbox A is True

Percentage cant be lowef than 26 if checkbox A and B are True.

I tried this but not working 
OR(AND(CheckboxA = TRUE, CheckboxB = TRUE, Discount__c < 0.26),
AND( CheckboxA = TRUE,Discount < 0.30))

 
Best Answer chosen by Balaji Sundar
Ankush AgarwalAnkush Agarwal
Please find below the updated one:
 
AND(
OR(
  ISNEW(),
  ISCHANGED(CheckboxA),
  ISCHANGED(CheckboxB),
  ISCHANGED(Discount__c ),
),
OR(
    AND(CheckboxA, CheckboxB, Discount__c < 0.26 ),
    AND(CheckboxA, NOT(CheckboxB), Discount < 0.30)
)
)

 

All Answers

Ankush AgarwalAnkush Agarwal
Hi Balaji,

You may try with below:

AND(
OR(
ISCHANGED(CheckboxA),
ISCHANGED(CheckboxB),
ISCHANGED(Discount__c ),
),
OR(
AND(
CheckboxA,
CheckboxB,
Discount__c < 0.26
),
AND(
CheckboxA,
NOT(CheckboxB),
Discount < 0.30
)
)
)
Andrew FragiasAndrew Fragias
Hi Balaji,

Your conditions where effectively colliding so try this:
OR(AND(CheckboxA = TRUE, CheckboxB = TRUE, Discount__c < 0.26),
      AND(CheckboxA = TRUE, CheckboxB = False,Discount < 0.30))

 
Ankush AgarwalAnkush Agarwal
Please find below the updated one:
 
AND(
OR(
  ISNEW(),
  ISCHANGED(CheckboxA),
  ISCHANGED(CheckboxB),
  ISCHANGED(Discount__c ),
),
OR(
    AND(CheckboxA, CheckboxB, Discount__c < 0.26 ),
    AND(CheckboxA, NOT(CheckboxB), Discount < 0.30)
)
)

 
This was selected as the best answer
charu goyalcharu goyal
Hi Balaji,

You must use CheckboxB =false in second condition. Take a scenario, let checkboxA = true, checkboxB = false and discount > 26% but less than 30%. Then also you got the error. Because second condition becomes true id checkboxB condition is missing. 

I have tested below formula and it is working perfectly fine.Could you please try it once. 
IF(AND(Checkbox_1__c = true, Checkbox_2__c = true,Discount__c < 0.26),true,
     IF(AND(Checkbox_1__c = true,Checkbox_2__c = false,Discount__c < 0.30),true,false))

Please mark it as your best answer, if it resolves your issue.

Regards,
Charu Goyal
Purushotham ManoharPurushotham Manohar
Hi Balaji,

Pls try this one 

IF( Check2__c  = TRUE, AND ( Check1__c  = TRUE , Percentage__c < 0.26 ), AND ( Check1__c  = TRUE , Percentage__c < 0.30 ) )

Kindly mark it as best answer if it resolves your issue 

Regards,
Purushotham
Ankush AgarwalAnkush Agarwal
Hi Balaji,

If it is resolved, could you please mark solution as Best Answer to close this thread.