• Jayyy
  • NEWBIE
  • 25 Points
  • Member since 2017

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello All,

I have ocausinally Callout time out while calling a webservice. I have created a queuable job to retry my request whenever exception occurs. Below is my exception handling and the code that I used to create Queueable job:
try{
// APEX Call out
}catch(System.CalloutException e){
            CQCLocationImporterQueueable retryJob = new CQCLocationImporterQueueable(pageUri);
            ID jobID = System.enqueueJob(retryJob);   
            throw new applicationException('Callout Exception has been occured while calling CQC API. retry job has been created with Id:' + jobID); 
        }catch(applicationException e){
            CQCLocationImporterQueueable retryJob = new CQCLocationImporterQueueable(pageUri);
            ID jobID = System.enqueueJob(retryJob);   
            throw new applicationException('Callout Exception has been occured while calling CQC API. retry job has been created with Id:' + jobID); 
        }
My BatchJob has failed with Status Detail:

First error: Callout Exception has been occured while calling CQC API. retry job has been created with Id:7078E00000P2XlE

However I could not find the job with specified Id 7078E00000P2XlE in Apex Jobs view or by querying AsyncApexJob object.
 
SELECT Id, Status, NumberOfErrors FROM AsyncApexJob where Id = '7078E00000P2XlE'

I have tested my code in Anonymous Window and it got executed successfuly and the Queueable Job has been created sucessfully. So what I have missed in my code?

Thanks,
Ahmed Kishk
My question is, is each data load considered as one execution context or each trigger has it's own context? It would help me understand where more time is being spent. Whether time is being spent in 1. switching between multiple triggers (I know its bad practice. But, cant change so quickly now) or 2. This one trigger which is looping for 400-5000 times and creating possibly some insertions?
  • June 21, 2018
  • Like
  • 0
Apex Triggers : If an object has multiple (assume two) before triggers and if first picked trigger inserts a record, is second trigger invoked twice? First time from the initial insert and second time due to an insert operation from first trigger. (I understand order is not guaranteed. but, jsut thinking what would happen if it is picked this way)
  • June 21, 2018
  • Like
  • 0
Apex Triggers : If an object has multiple (assume two) before triggers and if first picked trigger inserts a record, is second trigger invoked twice? First time from the initial insert and second time due to an insert operation from first trigger. (I understand order is not guaranteed. but, jsut thinking what would happen if it is picked this way)
  • June 21, 2018
  • Like
  • 0
Hello All,

I have ocausinally Callout time out while calling a webservice. I have created a queuable job to retry my request whenever exception occurs. Below is my exception handling and the code that I used to create Queueable job:
try{
// APEX Call out
}catch(System.CalloutException e){
            CQCLocationImporterQueueable retryJob = new CQCLocationImporterQueueable(pageUri);
            ID jobID = System.enqueueJob(retryJob);   
            throw new applicationException('Callout Exception has been occured while calling CQC API. retry job has been created with Id:' + jobID); 
        }catch(applicationException e){
            CQCLocationImporterQueueable retryJob = new CQCLocationImporterQueueable(pageUri);
            ID jobID = System.enqueueJob(retryJob);   
            throw new applicationException('Callout Exception has been occured while calling CQC API. retry job has been created with Id:' + jobID); 
        }
My BatchJob has failed with Status Detail:

First error: Callout Exception has been occured while calling CQC API. retry job has been created with Id:7078E00000P2XlE

However I could not find the job with specified Id 7078E00000P2XlE in Apex Jobs view or by querying AsyncApexJob object.
 
SELECT Id, Status, NumberOfErrors FROM AsyncApexJob where Id = '7078E00000P2XlE'

I have tested my code in Anonymous Window and it got executed successfuly and the Queueable Job has been created sucessfully. So what I have missed in my code?

Thanks,
Ahmed Kishk