You need to sign in to do that
Don't have an account?
Lucifer
Date methods ??
I'm trying to create a shedule job that sends email alerts 2 days befor due date. But some how list task near overdue doesn't let me save. It shows problem with the last "And" part( The highlighted part). Could somebody point me out where I am going wrong?
List<Task> tasksNearOverdue =[SELECT Id, ActivityDate, Subject FROM Task WHERE WhatId IN :requestIds AND IsClosed = false AND :Date.today().addDays(-2) >= ActivityDate ] ;
Hi Lucifer,
In your query, you're starting your where clause with a method. your LHS of a condition should always be a field from the object and RHS should be a variable or a method.
I tried this, it works:
List<Task> lst = [SELECT Id, ActivityDate, Subject FROM Task WHERE IsClosed = false AND ActivityDate <= :Date.today().addDays(-2)];
Let me know if you have any questions.
All Answers
Hi Lucifer,
In your query, you're starting your where clause with a method. your LHS of a condition should always be a field from the object and RHS should be a variable or a method.
I tried this, it works:
List<Task> lst = [SELECT Id, ActivityDate, Subject FROM Task WHERE IsClosed = false AND ActivityDate <= :Date.today().addDays(-2)];
Let me know if you have any questions.
Thanks Vishal.. You are such a life saver..
Glat to help. Anytime!