You need to sign in to do that
Don't have an account?
Scheduled Apex Job
Hi everyone,
I have a couple of question. How do i get my scheluded apex job to show up in monitoring? How can i add picklist values from status in my String checkLead? if i add status = 'open', 'closed' at the end the string breaks because im adding '.
-hkp716
apex class:
global class leadfollowup30day implements Schedulable{
global void execute(SchedulableContext sc)
{
leadfollowup30day t = new leadfollowup30day();
String sch = '0 0 11 * * ?';
system.schedule('30 day lead followup', sch, t);
}
public static Date todayMinusThirty = system.Today().addDays(-30);
public static String checkLead = 'select Id, status, LastModifiedDate from Lead WHERE (LastActivityDate = :todayMinusThirty OR LastActivityDate = NULL) AND LastModifiedDate = :todayMinusThirty';
public static void updateLeads ()
{
//system.debug('\n\n30 checkLead ' + checkLead);
//collect a list of records
List <Lead> setfollow = Database.query(checkLead);
for (Lead ld :setfollow)
{
Task t = new Task();
t.Subject = 'Needs Follow up - No Activity in 30 days';
t.OwnerID = ld.OwnerID;
}
}
}
............. And status IN (\'open\', \'closed\')';
leadfollowup30day t = new leadfollowup30day();
String sch = '0 0 11 * * ?';
system.schedule('30 day lead followup', sch, t);
then it will be submitted to the Monitoring -> Scheduled Jobs
Hi Jia Hu,
Thanks for the response, i figured i would execute anonymously. I'll test the new string and get back to you.
-hkp716
Hey Jia Hu,
The job was scheduled and the class ran but it did not assign a task. I think theres something wrong with my list query.
Thanks for the help,
hkp716