Timeline for SOQL query with Date fields is not returning the expected result
Current License: CC BY-SA 4.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 23, 2019 at 19:41 | comment | added | apz | Had to give the same value for ActivityDateTime along with ActivityDate. | |
Apr 23, 2019 at 19:13 | comment | added | Charis Moutafidis | So what was the issue? | |
Apr 23, 2019 at 15:02 | vote | accept | apz | ||
Apr 23, 2019 at 14:50 | comment | added | apz | @NoorAShuvo Correct me if am wrong, May 25th, 2005 is greater than May 5th, 2005. | |
Apr 23, 2019 at 14:50 | comment | added | apz | @MarkPond Greater than. I also tried with equal to but no difference. | |
Apr 23, 2019 at 14:50 | comment | added | apz | @CharisMoutafidis ActivityDate is a field of type Date. If this was the case then it'd throw a compile error. | |
Apr 23, 2019 at 2:33 | comment | added | Noor A Shuvo | It is expected to return the list size 0 as ActivityDate is not greater than 2005-05-05 . You have to use DateTime if you want it to work as your expected | |
Apr 23, 2019 at 1:51 | answer | added | Json Bourne | timeline score: 0 | |
Apr 23, 2019 at 1:49 | comment | added | Json Bourne | @Apz I am not sure what exact data you are using but following worked for me in my Sandbox. Event e = new Event(); e.ActivityDateTime = DateTime.newInstance(2005,05,25,12,00,00); e.ActivityDate = Date.newInstance(2005,05,25); e.DurationInMinutes = 30; insert e; List<Event> myList = [SELECT id, ActivityDate FROM Event WHERE ActivityDate > 2005-05-05 AND ActivityDate < 2005-06-05]; System.assertEquals(1,myList.size()); | |
Apr 22, 2019 at 23:12 | comment | added | Mark Pond |
Did you expect this to be greater than or equal to? WHERE ActivityDate > 2005-05-05
|
|
Apr 22, 2019 at 22:36 | comment | added | Charis Moutafidis | Silly question but are you use ActivityDate is a field of type Date and not DateTime? | |
Apr 22, 2019 at 22:15 | history | asked | apz | CC BY-SA 4.0 |