+ Start a Discussion
Ron WildRon Wild 

setMethodName for AsyncApexJob

I'd like to check to see if a batch job is already queued before starting it again, but haven't been able to figure out how to identify my job... the MethodName is always empty so I can't search for the job by it's method name like so:

 

// Check to see if batch update is already queued or in process
AsyncApexJob[] queuedJobs = [ Select a.Status, a.MethodName, a.Id From AsyncApexJob a where status in ('Queued','Processing') and MethodName like '%BatchUpdateCampaignPayments%'];
if (queuedJobs.size() >0) return;

 

And I don't see any way to set the MethodName when starting the job.

 

 

Any ideas?

 

Thanks,

Ron

Message Edited by Ron Wild on 10-03-2009 05:33 PM