0

can someone explain why the formula below has no syntax error:
Days to Close (Number) = CloseDate - TODAY()

but the one below has a syntax error:
Days Since Last Update (Number) = LastModifiedDate - TODAY()

They are both subtracting date fields but I'm getting the following error from the second one:
Error: Incorrect parameter type for operator '-'. Expected Number, DateTime, received Date

Does't make any sense to me. Can someone make sense of this. Thanks

  • I hope you are talking about the closedate field on opportunity.CloseDate is a field of type "Date" whereas "LastModifiedDate" is a field of type "Date Time"."Today()" function returns value of type "Date".So the lastmodifieddate should be converted to date inorder to subtract it from today() as per the below answer help.salesforce.com/… – Preya Feb 1 '17 at 4:44
2

LastModifiedDate is a DateTime field

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/system_fields.htm

Use DATEVALUE(LastModifiedDate) - TODAY()

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.