For the life of me I cannot figure out how to query tasks greater than a given DateTime. I have a field, inqDateTime, that I need to pull tasks greater than that date. I have tried to convert the DateTime to a Date field, but then I get zero returns because it lacks the T and Z from the value, I guess?
So then I tried to use the DAY_ONLY bit in the WHERE clause, but I get errors like crazy expecting a ;
.
How do I use a DateTime field and get all tasks from that date?
For reference, here is my code:
@AuraEnabled
public static integer taskQuery(DateTime inqDateTime, id leadID){
System.debug('militaryQuarantineController.taskCount running.............................................................');
//Date inqDate = Date.newInstance(inqDateTime.year(), inqDateTime.month(), inqDateTime.day());
DATE inqDate = inqDateTime.DATE();
//String inqDate = DateTime
System.debug('inqDate = ' +inqDate);
List<Task> taskList = [SELECT id FROM Task WHERE whoid= :leadID AND TaskSubtype!='Task' AND ActivityDate >= : inqDate];
System.debug('There are ' +taskList.size()+ ' tasks since the last inquiry');
integer taskCount = taskList.size();
return taskCount;
}
System.debug([SELECT id FROM Task WHERE whoid= :leadID AND TaskSubtype!='Task' AND ActivityDate >= : inqDateTime]);
SELECT ActivityDate,Id,TaskSubtype FROM Task WHERE ActivityDate >= 2018-11-02 AND TaskSubtype != 'Task'