2

I have written this formula but getting error:

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

IF
(
  AND (Account.Name <> null,
       Account.Primary_Campaign__c = null), 
  OR  (AND ( Account.Name <> null, 
             Account.Lead_Source__c=null )),
  true,
  false
)
1
  • 2
    That error message is pretty straightforward. You have four parameters for you IF() function.
    – martin
    Commented Mar 14, 2017 at 8:34

2 Answers 2

1

This validation rule will cause an error to be fired whenever your Account has blank values for both Primary_Campaign__c and Lead_Source__c.

AND (
  ISBLANK ( Account.Primary_Campaign__c ) , 
  ISBLANK ( Account.Lead_Source__c )
)

If either field, or both, have values, there will be no error.

1

Here is your formula:

IF(
    AND(Account.Name <> null,Account.Primary_Campaign__c = null), 
    OR(
        AND(Account.Name <> null, Account.Lead_Source__c = null)
    ),
    true,
    false)

Error message is quite descriptive enough, which says there are 4 parameters in IF condition.

To resolve this enclose the condition in a parenthesis:

IF(
    OR(
        AND(Account.Name <> null,Account.Primary_Campaign__c = null), 
        OR(
            AND(Account.Name <> null, Account.Lead_Source__c = null)
        )
    ),
    true,
    false)
2
  • Hello Rahul, I have tried above formula but getting error : Syntax error. Missing ')'
    – user42894
    Commented Mar 14, 2017 at 8:40
  • I see, updaed the formula, Use OR condition. But I thing you should really refactor the formula
    – Raul
    Commented Mar 14, 2017 at 8:42

You must log in to answer this question.