function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OlegBOlegB 

Filtering on Date vs DateTime fields

Did SalesForce start enforcing the query parameter distinctions between the Date and DateTime fields?

A query containing a DateTime field in a filter condition used to take date-only parameters just fine.
I.e. select id from Sales_Forecast__c where CreatedDate > 2007-01-19 was not causing any problems even though the CreatedDate is a DateTime field and we’re giving it a date-only param. Now that causes an error, but this select id from Sales_Forecast__c where CreatedDate > 2007-01-19T11:11:11Z runs ok.

Did anyone else notice this? Could someone from SF please confirm or deny this?

Thanks,
Oleg.

SuperfellSuperfell
This is in the 8.0 api release notes, starting with the 8.0 API, the comparisions are forced to be of the same type, although you could mix them before, the odds that they actually did the right thing are pretty small.
The old behvour is still supported on the older api versions, so this shouldn't cause any regressions.
OlegBOlegB
Thanks, Simon.