You need to sign in to do that
Don't have an account?
How to get Apex Job Id from AsyncApexjob
Hi , i have created a custom VF controller which fetches some details of "Scheduled Apex Jobs" from AsyncApexJob object.
In My query i m not able to get the Apex job id from AsyncApex object. it Throws an error "Job id column" does not exists in AsyncApex job object But when i see it salesforce standard UI , i can see a column called "Job ID"in Scheduled Apex Monitor. From Where can i get the Apex Job Id of Scheduled Apex. Also if it is not there in AsyncApexJob object , then where(in which object) is this apex job id stored. Important point to note is " I m just using scheduled apex and not Batch Apex."
Pls help
Hi,
When you perform a query from "AsyncApexJob" then the ' Id' field gives the value of 'Apex job id'
AsyncApexJob aaj = [SELECT Id, Status, JobItemsProcessed, TotalJobItems, NumberOfErrors
FROM AsyncApexJob WHERE ID =: batchprocessid ];
System.Debug('Apex job id==='+aaj.Id);
Please let me know if the issue is persist,If this post is helpful to you please give kudos(click on star at left) amd mark it as a solution.
Actually we are not using batchable context.. we are using Schedulable Context. Here your solution will need a batchprocess id
Hi,
Please provide me your code.So I can understnad the issue
I ran the following in the SOQL Query Editor of the Developer Console :
select Id, NextFireTime, CronJobDetail.Name from CronTrigger
Then I paged through the names to find the one I wanted to stop. Once I had that Id, it was a simple matter to go to the Debug->Execute Anonymous Window and do a
System.abortJob(id)
So if your names are well-defined in the CronJobDetail you should be able to pull whatever information you need.
Thanks!