Questions tagged [queueable-apex]
The queueable-apex tag has no usage guidance.
127
questions
3
votes
1
answer
95
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 ...
0
votes
2
answers
72
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....
0
votes
1
answer
54
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: ...
1
vote
2
answers
65
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, ...
0
votes
1
answer
48
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 ...
-1
votes
1
answer
54
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 ...
0
votes
0
answers
30
views
Changeset validation failing with insufficient code coverage
I have an apex class with a platform event trigger that calls a queueable apex using System.enqueueJob() which in turns makes a web service callout in a try-catch block. The response returns by the ...
3
votes
0
answers
89
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 : ...
0
votes
1
answer
153
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 ...
0
votes
1
answer
55
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....
-3
votes
1
answer
156
views
Salesforce limit for concurrent calls of Async Apex
What is the limit of max concurrent calls for
Batchable apex
Queueable apex
Future methods
Need the Limit for both the scenarios 1. Limit for running the same batch (with different transactions), 2. ...
1
vote
0
answers
60
views
Resubmit API Callout from Queueable method
I am working on an assignment where I need to process some subscribed events in Salesforce when a third party system publishes an event. The third party system publishes an event when there is a ...
0
votes
2
answers
73
views
Queuable Apex callout
Requirement is to loop through set of records(could be in 1000's) and make a REST callout to process those records. I did went through multiple Q&A posted in the community but still stuck with it. ...
0
votes
0
answers
63
views
Phantom Runaway Queuable Job "Limit Check"
I have some very strange sandbox behavior - there is a runaway queuable job that appears to be doing absolutely nothing in the system, last only .006 seconds, and completely locks up the system as it ...
0
votes
1
answer
87
views
Queueable insert list records from map and keep order
I have Map with Account and Account Id. I want to insert that accounts in Queueable and return list of all ids in order as acount is inserted(Or map, it doesnt really matther). How can i keep order if ...
4
votes
2
answers
541
views
How to avoid System.AsyncException: Maximum stack depth has been reached [duplicate]
I need to consume an API from an external source and insert it in my Enterprise org.
I have to retrieve 200 at most in every transaction. I implemented a Queueable Apex class that chains itself in the ...
0
votes
1
answer
54
views
Why Queueable came into the picture [duplicate]
Why Queueable came into the picture when we already had Batch Apex available to Us. I know Queueable is better than future in context of accepting non-primitive data types and for job monitoring and ...
0
votes
1
answer
301
views
How to use Wrapper Class in constructor and call it in Queueable?
My Queueable Apex class worked fine before but after discovering Apex PMD ruleset, found that using >4 parameters in any method or constructor is not best practice. I tried searching up answers ...
0
votes
1
answer
841
views
Chain from Queueable
Is it possible to make a chain of execution with Queueable?
My task after running the first Queueable is to get a token (callout) and only when it is available (in Custom MetaData) to run the next ...
3
votes
1
answer
46
views
Queueable sits in "Processing" state then throws GACK: Salesforce System Error: Exception serializing: myNs.MyQueueableClass
I've got a class with a finalizer, more or less like this:
public with sharing class queueableRepro implements Queueable, Finalizer {
Set<Id> someIds = new Set<Id>();
SomeClass ...
0
votes
1
answer
85
views
How would I resolve a 429 error that does multiple api callouts from a scheduled class that calls multiple instances of a Queueable class
I have a scheduled class that calls a Queueable class which does an api callout. What seems to be happening is once the scheduled class is done setting up all of the queueable classes to run, they all ...
6
votes
2
answers
980
views
Infinite queueable chaining, what is the drawback?
As mentioned here
Because no limit is enforced on the depth of chained jobs, you can
chain one job to another. You can repeat this process with each new
child job to link it to a new child job.
What ...
5
votes
2
answers
497
views
How can I share state between 'Queueable' executions?
I am developing a Queueable class to send data to an external system via HTTP callouts. I am planning to chain this class to call itself multiple times, until all records have been processed, or until ...
-1
votes
1
answer
54
views
How to store the Job id in static variable in two different executions [closed]
I am having the trigger code in account object in both delete and insert context variable.I want to change the operations in queuable in trigger handler.
If(Trigger.isafter && Trigger.isInsert)...
0
votes
1
answer
350
views
Where does Queueable job gets Queued?
I wrote this class:
public with sharing class QueueTest1 implements Queueable, Finalizer{
public QueueTest1(){
}
public void execute(FinalizerContext param1) {
System.debug('...
0
votes
1
answer
384
views
Using Finalizers to Work Around Too many queueable jobs added to the queue: 2?
I was testing Finalizer interface with Queueable apex and I think it can also be used to overcome this error: System.LimitException: Too many queueable jobs added to the queue: 2
I created a class ...
1
vote
2
answers
99
views
Q&A: Are there problems using System.abortJob() in Test Methods to Avoid Depth Max Governor Limit
Been posting here a bit around the ideas of Queueable Chains and test Methods. All of you have been very helpful. I had one last piece I ran into during deployment that I had to fix. The code snippet ...
0
votes
1
answer
80
views
Get Full Coverage on Queable Chain of API Calls
Problem
I have process that is a Queueable Chain that calls 9 different Queueable Classes (below is 2/9 but all follow this pattern). Of these, 8 are making API callouts to another Salesforce Org. ...
0
votes
0
answers
93
views
Testing queueable method which relies on jobId
I've updated my code to do some logic along these lines
if no job has been created, create a job using System.enqueueJob(QC) and store it's job id.
take a bunch of data and store it in a custom ...
3
votes
3
answers
566
views
Chain Methods with Class that Implements Queable
Update Attempt to Chain in Helper Class -- Not Working -- Separate Class Still Works.
My last update was premature. This doWork method still does not control the order of the calls once they are ...
2
votes
1
answer
196
views
Queueable Apex User Context in Unit Tests with System.runAs block not the same as productive code
I noticed that the running User Context of a Queueable Job in a unit test depends on who calls the Test.stopTest() method. Or rather when is the job to be executed in the unit test context. I wonder ...
0
votes
1
answer
463
views
Too many queueable jobs added to the queue: 2 Testing Help Needed!
I have a problem on my hands around getting enough code coverage for the below code I am working on.
The Scenario: When a CPQ quote is being worked and it is a primary quote I have a process builder ...
0
votes
0
answers
97
views
You have uncommitted work pending. Please commit or rollback before calling out in Queueable apex
I am getting the following error
You have uncommitted work pending. Please commit or rollback before calling out
while executing the below code
global class AmendContract_Queueable implements ...
-1
votes
1
answer
118
views
How to avoid Too many queueable jobs added to the queue: 2
I am trying to run a test class which is inserted and updating the same account.
I do have a queaueable class calling from onAfterInsert and onAfterUpdate. Do I have a quick fix for it?
public void ...
0
votes
0
answers
95
views
Why I am not able to update the fields in account after queable class is executed
I have a scenario where I need a better approach. I am trying the Queueable class for the first time.
I have an AcccountTriggerhandler on which I am calling the Queueable class on onAfterUpdate.
Once ...
0
votes
2
answers
432
views
Batch job chunks calling queueable jobs transaction limit
This is a basic question instead of code related. I am writing a batch job which will update Application__c records. Trigger for Application__c object, enqueues a queueable job to update cases
Batch ...
0
votes
0
answers
155
views
Will a Queueable Class run in series if it is recursive?
I have a scenario where I need to call an API from a trigger that will update a few fields from the API. The trigger is an after insert and is setup to avoid recursion with other triggers on the same ...
0
votes
1
answer
79
views
Queuable apex basics
I have a method in apex class
public static void test(List<contact> newOppProdList,Map<Id,contact> oldOppProdList){
List<test__c> testprod= [Select Id,name from test__c];...
0
votes
1
answer
108
views
Is there a way to add data to an enqueued job?
I have a situation where my managed package has triggers that kick off an asynchronous method. I'm running into an issue where if an aync. Process fires my trigger twice causing me to hit a governor ...
3
votes
1
answer
166
views
How to monitor not yet started jobs of a Queuable chain
I am wrapping my head around how to use Apex Queuable as a queue and not as a chain.
As I understand all the code samples out there, the next job is enqueued after the work of the previous one is done....
2
votes
1
answer
86
views
Why does adding a Queueable cause an INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error?
I have code that inserts a ContentVersion (a File) that is run under a "Customer Community Login" license inside a Community/Experience. That works fine.
I now have an optional asynchronous ...
0
votes
0
answers
67
views
Executing a callout at the end of a chain of methods operating in @future context
I have a callout method that is executed as the last step of a long chain of methods when a record's status get changed to "completed". Early in this sequence, we have a method that we have ...
1
vote
0
answers
36
views
Enqueuing chained queueable instances that trigger deployment jobs don't perform deployment
I've got problem with executing deployment jobs inside queueable instance.
Background:
Exchange rates data is divided between two endpoints a and b. That's why I need to make a callout twice.
...
0
votes
2
answers
378
views
How to replace _id with id in a JSON response using REST API?
I am making a GET callout to the URL: https://th-superbadge-apex.herokuapp.com/equipment?_ga=2.245262661.1986105727.1612691455-984520333.1610882684. In the URL, the id field starts with _id which I ...
3
votes
1
answer
982
views
Can Database.executeBatch be called from a Queueable started by System.enqueueJob?
I'm aware that you can't call Database.executeBatch from the execute method of an already running Batchable.
But can Database.executeBatch be called from a Queueable running via System.enqueueJob? I'm ...
0
votes
1
answer
476
views
What user is queueable apex class running as?
I have a queueable class, that is executed correctly (and working asynchronosly calling external services)
I have an issue, that within the class, the following line:
system.UserInfo.getUserEmail()
...
4
votes
0
answers
625
views
What is Causing INVALID_TYPE_ON_FIELD_IN_RECORD Error in Queueable Class?
Goal
My goal is to create a reusable Apex action/invokable method to allow a flow to asynchronously insert/update/delete a collection of records using the queueable interface.
Note that I am aware of ...
0
votes
1
answer
354
views
can queueable method set a trigger handler static variable
Title of the question is mis-leading. Since yes, a queueable method can access a static variable of a class. But i have an existing old implementation, and i am trying to refactor and clean it up. ...
1
vote
2
answers
150
views
How to remove SOQL Query from the for loop by Queueable in apex
I need to retrieve the field value given subject. But the only way I find to do it is by doing a dynamic query in a For or loop. Did anyone have a solution to avoid the query in the loop? Or any other ...
0
votes
1
answer
951
views
calling a queueable from a trigger and avoiding overfilling the flex queue
So I'm refactoring some code for my company, we have some triggers that all call a common method. I'm going to refactor that class to be queueable. My first implementation of it was to just change the ...