0

I am creating a process builder to field update a date field (Requested Start Date) that should be 14 business days after the Close Date. The field I'm updating is a date field and so is the field I'm referencing in the formula.

I am receiving an error: "The formula expression is invalid: Incorrect parameter type for function 'IF()'. Expected Date, received Text"

My formula:

IF(
    MOD( [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate  - DATE(1900, 1, 6), 7) > 2,
    [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 20,'',
    IF(MOD( [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate - DATE(1900, 1, 6), 7) > 0,
        [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 19,''
        )
    )
1

You have excess parameters in your IF() function, and one of them is the wrong type.

Indentation can often help to show these parameter-count and grouping problems:

IF(
    MOD([Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate  - DATE(1900, 1, 6), 7) > 2,
    [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 20,
    '',
    IF(
        MOD([Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate - DATE(1900, 1, 6), 7) > 0,
        [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 19,
        ''
    )
)

IF() takes exactly three parameters: a condition, a value if it's true, and a value if it's false. Your outermost IF() has four parameters, and your inner IF() has three (as is correct).

Both IF() expressions are receiving mixed data types. Your true parameter (the second one) is a Date value. But the third, which is superfluous on the outer IF(), is an empty string. You probably want null in that position for the inner IF().

Your formula ought to compile if you make those changes:

IF(
    MOD([Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate  - DATE(1900, 1, 6), 7) > 2,
    [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 20,
    IF(
        MOD([Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate - DATE(1900, 1, 6), 7) > 0,
        [Campaign_Design_Profile__c].Related_Opportunity__c.CloseDate + 19,
        null
    )
)

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.