I have to create validation rule where SLA is GOLD, should have a value and also SLA serial number can only be numeric. I have written this way

AND(ISPICKVAL( SLA__c , 'Gold'), ISBLANK(SLASerialNumber__c ),
IF(NOT(ISNUMBER(SLASerialNumber__c )))

Which gives me the error:

Incorrect number of parameters for function 'IF()'. Expected 3, received 1

1 Answer 1


Just get rid of the IF. NOT returns a Boolean result, as does ISNUMBER.

From the Visualforce Developer Guide | Functions:

Function NOT
Description Returns FALSE for TRUE and TRUE for FALSE.
Use NOT(logical) and replace logical with the expression that you want evaluated.

Function: ISNUMBER Description Determines if a text value is a number and returns TRUE if it is. Otherwise, it returns FALSE.
Use ISNUMBER(text) and replace text with the merge field name for the text field.

So NOT(ISNUMBER(SLASerialNumber__c)) will yield TRUE (error case) if the serial number is not a number.

While the above advice will get your formula to compile, you should note that you are validating when the field is blank and this condition arises. You need the two conditions on the serial number to be joined with OR.

    ISPICKVAL(SLA__c, 'Gold'),
  • Thanks it worked out!!! So we need to use OR as there are two conditions.
    – user37357
    Sep 14, 2016 at 16:32
  • @user If this answer addressed your problem, please consider accepting it by clicking on the check mark/tick to the left of the answer, turning it green. This marks the question as resolved to your satisfaction, and awards reputation both to you and the person who answered. If you have >= 15 reputation points, you may also upvote the answer if you wish. There is no obligation to do either.
    – Adrian Larson
    Sep 14, 2016 at 16:37
  • You need to use both AND and OR. For the serial number part, though, you do need OR because you can't have both error conditions at the same time. @user
    – Adrian Larson
    Sep 14, 2016 at 16:42
  • The logic is not working even after I entered Only numeric when SLA is 'GOLD'
    – user37357
    Sep 15, 2016 at 17:07
  • It is showing the same error if I entered 'AB1111' or '1111'
    – user37357
    Sep 15, 2016 at 17:09

You must log in to answer this question.

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