($Profile.Name ="France User"), 
(OR(Max_Quantity__c < Asked_Quantity_Number__c , 
OR(Max_Quantity__c < BatchQuantity_Number__c , 

Max_Quantity__c, Asked_Quantity_Number__c, BatchQuantity_Number__c are number fields

i need the condition that: BatchQuantity_Number__c <=Asked_Quantity_Number__c <= Max_Quantity__c

The above validation rule is not working, can you suggest to me where it is going wrong?

1 Answer 1


You can really simplify this down, you've only got two real constraints, that batch quantity number is less than or equal to the asked quantity, and that the asked quantity is less than or equal to the max. Therefore if the batch is greater than the ask then the first condition would fail, and if the ask was greater than the max then the second would fail.

So you get (unless I've misunderstood your question):

  ($Profile.Name = "France User"), 
    Max_Quantity__c < Asked_Quantity_Number__c,
    Asked_Quantity_Number__c < BatchQuantity_Number__c

If you use the short cuts for AND() and OR() it's a bit easier to read:

($Profile.Name = "France User") && (Max_Quantity__c < Asked_Quantity_Number__c || Asked_Quantity_Number__c < BatchQuantity_Number__c)
  • one more doubt ,i wrote one validation for unitprice should always be greater than zero in the same visualforce page ,where Max_Quantity__c, Asked_Quantity_Number__c, BatchQuantity_Number__c,unitprice__c fields are there,
    – Teja
    Commented Nov 11, 2013 at 6:02
  • when saving the record with unit price less than zero ,it is showing error that unit price is greater than zero.
    – Teja
    Commented Nov 11, 2013 at 6:03
  • but when i am using another validation which you wrote above ,
    – Teja
    Commented Nov 11, 2013 at 6:04
  • when i am trying to save the record it is not showing error and it is not saving .why it is showing the error?..why it is showing the error in case of validation rule
    – Teja
    Commented Nov 11, 2013 at 6:06
  • with that unit price validation
    – Teja
    Commented Nov 11, 2013 at 6:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .