I have a scheduled job name with which I can query the same by using this:
SELECT Id, CronExpression, OwnerId, State, TimesTriggered, CronJobDetail.Name, CronJobDetail.Id, CronJobDetail.JobType FROM CronTrigger where CronJobDetail.Name = 'My job name'
I need to delete this job (any scheduled ones plus must not schedule any more in future), so as I understand from this answer here, I may delete this record from CronTrigger or use System.abortJob().
However, I fail to understand which Id I must pass to the System.abortJob. Is it the CronTrigger.Id or the CronJobDetail.Id? The Id in the Apex Job Id column under Setup > Apex Jobs doesn't match with any of these 2 Ids. Is the Apex Job Id the Id that I need to pass to the System.abortJob(jobId) instead? I went through System.abortJob documentation but unfortunately I am still confused.
My next question, what is a way of finding the mapping between the CronTrigger/CronJobDetail and the Apex Job Id (displayed in Setup > Apex Jobs)? I so far have found a way to view it only from the UI. Or is there no way of retrieving it if I myself havn't scheduled the job and stored the returned Id?
Note: I have no other information about the Job other than its name (not even the Apex class name).