0

I have this formula:

NOW()  -  Lead_Escalation_from_Production__c

And this is what the Lead_Escalation_from_Production__c field holds (our business hours):

IF(MOD(DATEVALUE(CreatedDate) - DATE(1900,1,7),7) = 6, 
DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate + 2)) & " 12:00:00"), 

IF(MOD(DATEVALUE(CreatedDate) - DATE(1900,1,7),7) = 0, 
DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate + 1)) & " 12:00:00"), 

IF(MOD(DATEVALUE(CreatedDate) - DATE(1900,1,7),7) = 5 && CreatedDate > DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 22:00:00"), 
DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate + 3)) & " 12:00:00"), 

IF(CreatedDate > DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 22:00:00"), 
DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate + 1)) & " 12:00:00"), 

IF(CreatedDate < DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 12:00:00"), 
DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate)) & " 12:00:00"), 

CreatedDate)))))

I am using a workflow rule that if the lead status is not open or has been converted i want it to do the formula above,NOW() - Lead_Escalation_from_Production__c, but I get the error message:Error: Formula result is data type (Number), incompatible with expected data type (Date/Time)

I would like to use now since it will get a closer time

Any suggestions?

  • 4
    It looks exactly the same, what did you change? – Michelle Mar 2 '16 at 15:11
  • He changed the number he adds to the CreatedDate – crmprogdev Mar 2 '16 at 15:47
  • From the initial look, the formula NOW() - Lead_Escalation_from_Production__c has return type Date/Time but it is actually returning the difference in number of days. So, you might have to change the return type to Number if that is what you're expecting. – sam_s Mar 2 '16 at 15:54
1

If you're trying to add a day, I suspect that's why you're getting the above error. In this part of your formula:

DATETIMEVALUE(TEXT(DATEVALUE(CreatedDate + 1))

CreatedDate +1 results in a number. You want to get the day(CreatedDate) or Month(CreatedDate) or Year(CreatedDate) before adding a number to it. You also want to remove the TEXT from this because you're returning TEXT Values, not numerical values that you do addition with!

| 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.