I am trying to figure out what I am doing wrong in this Salesforce formula. I am trying to find the MIN between two dates.
IF(
ISBLANK(Fulfillment_Date__c) && ISBLANK(Actual_Shipment_Date__c),
NULL,
IF(
ISBLANK(Fulfillment_Date__c),
Actual_Shipment_Date__c,
IF(
ISBLANK(Actual_Shipment_Date__c),
Fulfillment_Date__c,
NOW() - MIN(NOW() - Fulfillment_Date__c, NOW() - Actual_Shipment_Date__c)
)
)
)
I am getting the following error:
Error: Incorrect parameter type for operator '-'. Expected Number, DateTime, received Date
I don't know why as the Actual_Shipment_Date__c
and Fulfillment_Date__c
dates are Date data types.
Any help would be appreciated.
NOW()
will return datetime so its better to get the Date usingDATEVALUE()
and then use it.TODAY()
instead ofNOW()
, now gives date time typeDATEVALUE(NOW())
otherwise useTODAY()