1

I'm trying to write a (checkbox) formula field that looks at the stage name as well as days in a current stage. I am receiving an error that reads: "Incorrect parameter type for operator '>='. Expected Date, received Number"

IF(AND(ISPICKVAL(StageName, 'Initial Interest'), ((TODAY() - Initial_Interest_Date__c) >= 20)), TRUE,
    IF(AND(ISPICKVAL(StageName, 'Qualified Interest'), ((TODAY() - Qualified_Date__c) >= 30)), TRUE,
        IF(AND(ISPICKVAL(StageName, 'Solutioning'), ((TODAY() - Solutioning_Date__c) >= 40)), TRUE,
            IF(AND(ISPICKVAL(StageName, 'Contract Review'), ((TODAY() - Contract_Review_Date__c) >= 30)), TRUE,
                IF(AND(ISPICKVAL(StageName, 'Proposal Sent'), ((TODAY() - Solutioning_Date__c) >= 40)), TRUE,
                    IF(AND(ISPICKVAL(StageName, 'Waiting for Signature'), ((TODAY() - Contract_Review__c) >= 30)), TRUE,
                        FALSE)
                )
            )
        )
    )
)

Could anyone help?

  • 1
    Is Contract_Review__c a date? If not, that would explain the error. – sfdcfox May 16 '17 at 14:47
  • All of the fields labeled 'date' are in Salesforce as date fields – Carolyn May 16 '17 at 14:58
  • @Carolyn you're comparing Contract_Review__c to TODAY() in the last IF(), fox is suggesting that that field is not a date, and therefore causing the issue – Brian Mansfield May 16 '17 at 15:04
  • Oh thank you! Staring at your own code makes you miss the most basic things! Thank you @BrianMansfield and @sfdcfox! – Carolyn May 16 '17 at 15:06
  • @Carolyn Gave you an optimized version, as well. Give it a spin. – sfdcfox May 16 '17 at 15:17
1

One of the fields was not a date, and a date minus a number is another date, which can't be compared to a number.

Also, you can optimize your formula to be much more readable:

TODAY() -
CASE(StageName,
  'Initial Interest', Initial_Interest_Date__c,
  'Qualified Interest', Qualified_Date__c,
  'Solutioning', Solutioning_Date__c,
  'Contract Review', Contract_Review_Date__c,
  'Proposal Sent', Solutioning_Date__c,
  'Waiting for Signature', Contract_Review__c, 
  TODAY())
>=
CASE(StageName,
  'Initial Interest', 20,
  'Qualified Interest', 30,
  'Solutioning', 40,
  'Contract Review', 30,
  'Proposal Sent', 40,
  'Waiting for Signature', 30, 
  0)

(Note: exact syntax may vary, but this should be close).

| improve this answer | |

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.