Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [queueable-apex]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
29 views

Request.getCurrent().getRequestId() returns the same id if called inside a queueable chain

So if a have a chain of queueables that send outbound messages I grab the requestId using Request.getCurrent().getRequestId() and send it with the request for uniqueness it returns the same request ID ...
KarlLivesey's user avatar
1 vote
2 answers
376 views

Platform Events a nightmare - How to make them work in real life

I am trying to build a Platform Event-based application logger where arbitrary application code calls Tracker.log(...); and this is sent as an Event into an external database via an API. As it's ...
Robert Sösemann's user avatar
1 vote
0 answers
53 views

Why is AsyncOptions.DuplicateSignature property not working in System.enqueueJob function?

i have an issue with the class QueueableDuplicateSignature. Precisely on the property DuplicateSignature of the AsyncOptions class I'm trying to create a single Job for a certain process, call it &...
ViDev's user avatar
  • 11
1 vote
1 answer
51 views

Getting 'uncommitted work pending' even after putting in a queuable class

Getting 'You have uncommitted work pending. Please commit or rollback before calling out' error even after making the callout in a queuable class. Below the essence of the logic QueuableDummyclass.cls ...
Brav's user avatar
  • 820
1 vote
0 answers
23 views

How can I avoid Maximum stack depth has been reached on multi queueable single class? [duplicate]

I'm presenting the Maximum stack depth has been reached. error only on testing, how can avoid this error if I have created this nested queueable in just one class? This is the class used. global class ...
David Paucar's user avatar
0 votes
0 answers
30 views

Best practice to deal with HATEOAS api callouts

I'm creating an connector between Salesforce and a ticketing system that exposes a REST API based on HATEOAS. I need to synchronize tickets everyday and insert/update them as Cases. Salesforce is ...
Yan Imensar's user avatar
1 vote
1 answer
69 views

Do queueables have their own governor limits?

I have a class that makes consecutive API calls. I set the timeout to the maximum value allowed by Salesforce (120 seconds) however sometimes these are timing out because of the API taking way too ...
sfNewbie's user avatar
0 votes
0 answers
30 views

run a script in the the developer console while implementing interface [duplicate]

I'm trying to run a script from the developer console with the queueable interface implemented, but the execute method isn't called. code to put in Execute Anonymous Window in the developer console: ...
Json's user avatar
  • 1,667
0 votes
0 answers
129 views

I have two Queueable Jobs running in a transaction how to resolve it

On Order Product object I have an integration with a 3rd party system, which sends data the 3rd party whenever the Order Product through Queueable class. Now I am trying to insert a set of records to ...
Akshay Vasu's user avatar
1 vote
1 answer
118 views

Configure Stack Depth of Chained Queueable Jobs

I was going through the documentation related to the new AsyncOptions class, and looks like this is still in BETA. I remember this feature was released in Summer 23 release. https://help.salesforce....
nica's user avatar
  • 1,410
0 votes
1 answer
243 views

Making a lot of chained API calls in Apex

I'm supposed to make around 1500 chained API calls in apex. This is the process: I want to get a list of courses of a semester from an external server, then for each course, I want to make a separate ...
Rose Mirzaei's user avatar
1 vote
1 answer
125 views

batch vs queueable for pseudobulkification of an app

I'm testing out an app that uses a callout to check some info in a government database and writes back any hits to a custom object. The app is designed to be used via an action on a record page, but I ...
gorav's user avatar
  • 4,547
6 votes
0 answers
168 views

Handling uncatchable exceptions from chained queueable - finalizer hitting retry limit

We have a need to process a number of records (several thousand) using methods from a third-party managed package, which also involves callouts. We've achieved this by passing in the list of objects ...
James's user avatar
  • 205
0 votes
2 answers
464 views

Is it guaranteed that First submitted Queueable or Batch class will run first?

We have to send case create and update data via API to third party. For create case: In trigger we are collecting all the case ids in set and calling queueable class if cases created are less than 100 ...
Sukruti's user avatar
  • 472
-1 votes
1 answer
79 views

Independent Bulkification vs Batched Processing

I have been acquiring quite a bit of information about how bulkification and batch record processing works in salesforce (bits and pieces - salesforce documentation does not seem exhaustive). While I ...
Luke Sharon's user avatar
0 votes
1 answer
717 views

Queueable Apex - Too many DML Rows: 10001

Looking for some help with this. This class is failing due to the following error: 'Too many DML rows: 10001'. There's approximately 30,000 thousand records the class is trying to update, but I was ...
MattcG91's user avatar
6 votes
0 answers
104 views

Why can't a Queueable use an Iterator that comes from a Set?

I saw some surprising behaviour when storing the iterator obtained from a Set<Id> as a member in a Queueable class. So, I wrote the following trivial Queueable class to investigate: public class ...
Aidan's user avatar
  • 13.8k
3 votes
0 answers
149 views

Transaction Finalizers do not run when Queueable is "Aborted"

In my testing, it seems as though transactions finalizers do not run when the Queueable is aborted (via Apex Job -> Abort or other means). I'm unable to find any documentation confirming this. Is ...
NSjonas's user avatar
  • 10.2k
1 vote
0 answers
101 views

How to prevent the parent Queueable Job from having a 'Complete' status until the chained child Queueable job completes?

This is more of a theoretical question. I have an action button on a VisualForce page which downloads a PDF with large data. When the action button is clicked, it invokes a Queueable job through the ...
Knight of the Vale's user avatar
2 votes
2 answers
3k views

How to run the execute method of Queueable Apex?

I want to run the execute method of a Queueable Apex class Why I want to do that: To increase debugging speed. I want to anonymously call the method to avoid always enqueuing the job, going to setup --...
Gerke's user avatar
  • 155
-1 votes
1 answer
354 views

Pass Http Get and Http Post as asynchronous apex in order [closed]

My requirement is to pass data from my org (Salesforce) to external org (SAP S4). I have successfully made the class for integrating both. However, I need to pass this class in a trigger and since it ...
Capt Shaunz's user avatar
1 vote
2 answers
240 views

Does heap size consumption accumulate across chained asynchronous threads?

For asynchronous transactions, such as queueable jobs, the heap size limit is 12mb. Let's say I chain 2 queueable threads together. If I pass records queried in the first thread to the constructor in ...
Kevin Antonioli's user avatar
-1 votes
1 answer
84 views

How to run a JS function residing in a VF page once a Queueable class executed from the controller class finishes its execution?

I have a command button in my VF page (ABC.page) - <apex:commandLink id="DownloadDOC" onclick="getAllDataForDoc('{!listOfObjects}')" title="Download Document" ...
Knight of the Vale's user avatar
3 votes
2 answers
527 views

What is the reason behind the runtime error when Queuable jobs in enqueued?

If a public class implements both Schedulable and Queueable interface public class A implements Schedulable, Queueable { public void execute(SchedulableContext c) { // } public ...
Patlatus's user avatar
  • 17.3k
1 vote
1 answer
267 views

Aborted job restarts

I have an enqueued job using system.enqueueJob( new APEX_Job_Queueable() ); This job is a long running job which makes callouts to retrieve date. The callout returns a NextLink Url which, when ...
fredbe's user avatar
  • 135
0 votes
1 answer
127 views

I am Trying to chain queuable class and write test class but i am getting error System.AsyncException Maximum stack depth has been reached

error which i am facing System.AsyncException: Maximum stack depth has been reached public class AccountQueable implements Queueable{ public void execute(QueueableContext qc){ Account ...
mahesh babu's user avatar
0 votes
1 answer
484 views

Why is queueable not picking updated state?

Queueable class allows non primitive data type but they are also not picking updated state of object rather state that was passes to it when job was enqueued. Below is my snippet of code which I was ...
Elijah's user avatar
  • 849
0 votes
0 answers
2k views

Queueable Apex Job: INVALID_CROSS_REFERENCE_KEY, Owner ID: owner cannot be blank: [OwnerId]

I keep getting an error on this line when trying to update the lead list. "INVALID_CROSS_REFERENCE_KEY, Owner ID: owner cannot be blank: [OwnerId]" leadsToUpdate.add(new Lead(OwnerId = l....
happylittletrees's user avatar
0 votes
2 answers
207 views

Getting Current AsyncApexJob at Runtime

I'm trying to get the current AsyncApexJob. Using Request.getCurrent().getRequestId() and Request.getCurrent().getQuiddity() gets me that it is a Queueable that is running, but I'm looking for the ...
aaron's user avatar
  • 854
0 votes
0 answers
96 views

Does it ever make sense to use Queueable to enqueue a Batch Apex class?

A simple question. Does it ever make sense to use Queueable to enqueue a Batch Apex job? If I enqueue a Queueable job that executes a Batch Apex job, is it the same as if I executed a batch job from ...
DevelBase2's user avatar
0 votes
1 answer
3k views

Can I enqueue a Queueable from inside of the Queueable class itself?

I'm working on some code that needs to make callouts async (because it's run as part of a trigger) and am using Queueable. In my situation, there are some scenarios where the records are already in ...
Derek F's user avatar
  • 62.8k
0 votes
1 answer
250 views

Loosely coupled Queueable framework

Edit: Sorry for the confusion! I’m trying to use this generic framework I mentioned below the error message I’m getting from my code which is calling a standard queueable class. So, my question: I ...
Nick's user avatar
  • 7,074
-1 votes
1 answer
2k views

QUEUEABLE TEST CLASS

I have a request to create a queueable test class where the test class is to use @testsetup using a testdatafactory returning a complex wrapper class. The idea is the testDataFactor should populate ...
Daryn's user avatar
  • 251
0 votes
1 answer
278 views

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out Even I am Doing DML after callout

Description I am getting huge 30 mb csv data in chunks via api from aws and passing these chunks in Queueable Class that is called from same api class. Queueable Class is further calling batch apex ...
rose's user avatar
  • 1
1 vote
1 answer
256 views

Apex: I'm shoving all the DML into a queued job, but still get "Uncommited work pending"

So, I've heard that you cannot do any Callouts after a DML operation in Apex. So, I've designed my app this way (some pseudo-code follows): String url; List<Object> chunk; for (Integer page=1; ...
pilat's user avatar
  • 113
0 votes
1 answer
3k views

Future methods in flow actions

I've two flow actions which both make HTTP callouts. The second action depends on the output of the first. However, since future methods don't return a value, I'm unable to use the second action in ...
vishesh's user avatar
  • 763
0 votes
1 answer
837 views

Chaining Queueable Apex with Callouts Run Into Loop

I have a queueable class that is triggered from a trigger that makes a callout. I wanted to use Queueable for scenarios where I need to insert 3-5k of records and eventually make 3-5k callouts. But ...
kkJhn's user avatar
  • 23
1 vote
2 answers
831 views

Can/Should I chain queueable jobs using the System.Finalizer interface?

I have the below hypothetical and simplified code that updates accounts 10 at a time. The process will query for 10 account records during each queueable job. After the queueable job completes, the ...
parkerbbrown's user avatar
0 votes
1 answer
664 views

Record-triggered flow: change execution path based on runtime context

I have an Apex class that implements Queueable. It deletes records. I have a record-triggered flow that runs on after delete of the records. I want to prevent the flow from running (or performing its ...
SfdcBat's user avatar
  • 4,821
0 votes
1 answer
333 views

Heapsize error on Queueable class

I have a queueable class and I am doing a REST Callout. I am sending 2 files that are less than 12MB. When I run the code I am getting a Heap size error. Salesforce document says if you use Asyncrous ...
Tamil's user avatar
  • 724
16 votes
1 answer
7k views

Multiple future method from Queueable Apex

As per the documentation we can only call 1 future from Queueable context. But in below code I am able to call multiple future methods from same queueable class and no error is being thrown. public ...
Elijah's user avatar
  • 849
4 votes
1 answer
545 views

What can be achieved with Finalizers that was not achievable before?

I have gone through the documentation and read the examples and use cases. However, I am still struggling to understand how Finalizer add value and what can we achieve with it that was not achievable ...
Gabriel Serrano Salas's user avatar
1 vote
2 answers
2k views

queuable apex with more than 100 callouts

I am inserting more than 100 lead records via Data Import Wizard. I have the following trigger: if(Trigger.isAfter && trigger.isInsert){ if(Trigger.new != null){ system....
Col's user avatar
  • 71
0 votes
1 answer
263 views

How to test Apex queueable is stopped with given condition?

Here is my queueable, which stops at the beginning when condition is set. It seems that the initiated queueable instance in Test is gone after Test.stopTest()? The test execution error is Expected: ...
Xi Xiao's user avatar
  • 865
2 votes
2 answers
342 views

Mutation of Finalizer state

Below is the statement from documentation: The Finalizer framework uses the state of the Finalizer object, if one is attached, at the end of Queueable execution. Mutation of the Finalizer state, ...
Rajendra Singh Nagar's user avatar
0 votes
1 answer
860 views

Apex Limits.getQueueableJobs() in test class

I have a class where there is a if condition as below if (Limits.getQueueableJobs() == Limits.getLimitQueueableJobs()) In real time its called from batch context and Limits.getLimitQueueableJobs() is ...
Swap31's user avatar
  • 33
-1 votes
1 answer
290 views

Queuable chaining not working- First queueble doing webserivce call , second queueable should wait till result of first came

We have one use case we have to rely on external system to fetch the data and then only real time we can update the records in salesforce using values returned from webservice. we tried chaining using ...
David Mycka's user avatar
  • 1,327
3 votes
0 answers
305 views

Queueable Finalizer throwing "ConcurrentPerOrgLongTxn Limit exceeded."

We got some 50 mails for ConcurrentPerOrgLongTxn Limit exceeded. with heading as Developer script exception from ******** : Error processing finalizer for queueable job id: 7079G000000HhWs : ...
Nagendra Singh's user avatar
1 vote
1 answer
870 views

Test class for Transaction Finalizer is not working

I am stuck in the test class for the Transaction Finalizer class. Every time when we create an exception for Queueable class then Finalizer class executing and then the test class throws the error on ...
Naveen Tiwari's user avatar
1 vote
1 answer
460 views

UnitTestException: Maximum stack depth has been reached_Trigger Test class

I have 2 queueable classes and i have chained them in my account update trigger the logic is like below Trigger Logic- onAccountUpdate { Queueableclass1 que1 = new Queueableclass1(newList); System....
Sooraj57's user avatar