Questions tagged [queueable-apex]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
20 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
1answer
80 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
1answer
23 views

Return from a future/Queueable callout

I have to do a callout, but before doing the callout I need to update the cases and use the values from the cases' fields in the request body and then do the callout. I cannot do DML before callout. ...
0
votes
1answer
31 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
0answers
122 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
1answer
39 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
2answers
71 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
1answer
77 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 ...
2
votes
1answer
53 views

Prevent limits in a callout intensive process where client can only receive one request at a time?

I have a callout intensive process where the client can only receive one request at a time and I'm having a hard time identifying what is the best practice for asynchronous solutions to handle this ...
0
votes
1answer
58 views

Handling a combination of async callouts, schedulable jobs, and queueable jobs

The current requirements for my system is as follows: When a certain change is saved on the Account object, I need to create an Order object and make a callout to Service A. Service A finishes ...
4
votes
0answers
222 views

AsyncApexExecutions Limit exceeded different errors

We have a batch that is running queueable inside batch execute. And we are testing this framework with volume data to know its limits. To give an example, if I test it using 1000 records with 1 scope ...
3
votes
7answers
837 views

Implementing test class for Queueable Apex that makes call outs

I have a Queueable class MyQueueableClass which in turns calls an outbound web service class. public void execute(QueueableContext qc){ try{ GlobalCallout.makeCallout(caseId); } catch (...
0
votes
1answer
349 views

Future Callouts and Queueable from a Trigger

I am pretty new to salesforce development. I am trying to make a Callout to the third party API whenever a Account record is created in Salesforce. I tried to make the future callout and didnt realize ...
0
votes
0answers
71 views

Queueable class Too many SOQL queries: 201

I need to create a HTTPPost method to generate a report so when I did it at first, I had exceeded the number of queries limit so I implemented a queuable class to solve the issue as I have read in the ...
0
votes
2answers
427 views

Batch Apex vs Queueable

Thanks to another user (sfdcfox) I've got the following queueable apex being invoked via a screen flow that's being used to update account records. It's taking two string variables from the flow and ...
2
votes
1answer
126 views

How to call Queueable apex method from Visualforce Page commandButton?

Right now if I call the action button without Queueable Apex, from all the parameters I get from the Visualforce page and then perform action on the backend, due to the Apex Triggers I always will get ...
2
votes
1answer
203 views

Queueable apex invoked from triggers doesn't inherit sharing correctly

Consider the following class: public inherited sharing class testQueueableSharing implements Queueable { public void execute(QueueableContext context) { update [SELECT Id FROM User WHERE ...
1
vote
1answer
46 views

FATAL_ERROR System.LimitException: Too many DML statements: 151 is encountered when the test class is ran. Why?

Queueable class code is down below: public class AddPrimaryContact implements Queueable{ private Contact contacts; private String state; public AddPrimaryContact(Contact records, ...
0
votes
0answers
25 views

Queue members can not edit case record through Apex even though submitted record for approval is unlocked

I have two objects Contract and Case and if any cost update happens to contract through visualforce/lightning page, case trigger handler is fired to update also. Here are the recent changes done in ...
0
votes
2answers
631 views

How to capture Queueable class status when job is completed

I have created Queueable class to process data and making the callouts this Queueable class executes upon after update and after insert of Opportunity object. Now in order to track the status of ...
0
votes
1answer
54 views

Is there an api to submit queueable job? [Api for System.enqueueJob]

Is there an api that allows to submit Queueable jobs? (basically which simulates System.enqueueJob) Searched Rest Api and other apis but couldn't find anything.
0
votes
1answer
140 views

Platform Events - Fire platform event from event trigger?

We are planning to build some kind of a processing chain, when every item in an array is processed in separate scope of limits. Processing should happen strictly in a sequential way, i.e. second item ...
0
votes
1answer
97 views

too many queueable jobs added to the queue error - make 2nd callout upon receiving response from first callout [duplicate]

i have a triggerHandler class in which on after update i am sending list of records of Account object to queueable class public override void onAfterUpdate() { If( Limits....
4
votes
2answers
732 views

Queueable apex still executes in test context even if Enqueue Job is not called between Test.startTest() and Test.stopTest()

According to Salesforce docs: All asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously. ...
0
votes
1answer
133 views

Queueable design patterns to avoid “Too many queueable jobs added”?

When my CustomObject1 is inserted or updated, I need to update a field on the Account object potentially traversing all the CustomObject1 who have a lookup-relationship to given accounts. In ...
0
votes
1answer
72 views

Are queuable jobs given precendence over batch jobs

I am trying to move my vf page controller logic to queueable job to over come cpu time out. I am monitoring the queueable job by polling the server from my vf page and then redirecting the user to a ...
0
votes
0answers
37 views

Treatment after a queuable Job is over

When my users click Validate, I enqueue a job and I have for this job to be over, to continue the treatment. I'm doing it in three steps : enqueue the job, and return its ID (1) this is where I'm ...
4
votes
1answer
441 views

Queueable apex and trigger execution context

If I enqueue an instance of a Queueable class during a before trigger, is it guaranteed that the Queueable class will not run until the after trigger completes?
2
votes
1answer
139 views

Batch->Queueable->Callout+DML ::: Uncommited work pending issue

I am having following structure, where I am getting issue- CalloutException: Uncommited work pending. Ideally, with Queueable it should not throw the same error(since DML is happening at last in ...
0
votes
3answers
164 views

Trigger Recursion after API Callout to Run Territory Assignment Rules

I am trying to trigger territory assignment rules on accounts via the API (the only way you can, apparently), and then change the account owner based on the territories that are assigned. It’s an ...
0
votes
1answer
159 views

Creating Utility Classes - Batching sObject list

My goal is to create a reusable and scalable utility class that can perform different DML operations. I'm aware of the 10,000 DML processed records limit so I'd like to check if the list is greater ...
1
vote
1answer
89 views

Sending Inner class as a param from Queueable apex to a batch

I have a queueable apex that calls to a batch. Inside the queueable class - I have inner Class that writes a log with incorrect fields. The Inner Class inside the queueable class : public class ...
0
votes
1answer
55 views

Timeout Error: You have uncommitted work pending when Queueable is being called from trigger

I have a class with @future method: public without sharing class SubmitOnApproval { @future public static void oppRecordsToSubmit(id oppId){ Opportunity o = [select id, ...
0
votes
0answers
53 views

System.Debug() appears to be summing additional logged values

I'm running the following code, and I just want to log the total amount of deletes, and the total amount of records passed into the method and return the total amount of records that were processed ...
0
votes
1answer
52 views

update phone number field on Account obj off of phone number from Lead obj

I'm writing a Queueable Apex, that will run and compare search the Lead last name to the Account name if Lead lastname == Account name && Account phone field is null || blank then update the ...
7
votes
3answers
814 views

Queuable Apex logic in Constructor or Execute Method

I have a chained queuable apex class making an HTTP request to an external server. After each request comes back with a successful response, the next class will fire and make another request to a ...
1
vote
1answer
120 views

Queueable call not executing in case of partial success using Database.update

I have written logic that enqueues queueable class from trigger of one object. This works perfectly when I update records and all records gets updated successfully,but in case of partial success I can ...
0
votes
0answers
89 views

Multiple callouts dependant on each other in an InvocableMethod

I have an InvocableMethod apex function being called from Flow in which I make a total of 8 Web Callouts. They are all dependant on each other - so web callout 2 uses params returned by web callout 1 ...
1
vote
2answers
434 views

Why we are allowed to pass sObject in queueable?

I am having a small doubt, and want to have some inputs on that. For future methods, we are not allowed to have sObjects as method params/arguments. and the reason in documentation is stated as ...
0
votes
1answer
77 views

Queueable apex duration time issue

I'm running a Queueable that upsert contacts (in my example case it's just two contacts) and calling a batch with a Map < Id,String > - which Id is the Id of the upserted contacts, and the String ...
1
vote
2answers
53 views

Uncommitted work pending in unit test with queueable chain and httpcallout

I have a Schedule job that invokes a class and from there i call the Queueable class like this: ID jobID = System.enqueueJob(new NSQueuebleJob(acList)); The queueable class is: public class ...
4
votes
3answers
362 views

Apex more than 50 Queueble jobs

I have this class that call a Queueble job more than 50 times in a loop. I recive the error: Too many queueable jobs added to the queue. The limit is 50. Here is the class: global class ...
2
votes
1answer
671 views

How do SOQL queries act in Queueable (async) apex?

I have a set of 4 Queueable apex classes that perform an ordered series of tasks on a large number of records. It queries a limited number of records, modifies them so that they no longer meet the ...
1
vote
3answers
62 views

Future method completes first before the queueable

My scenario is: A future method is on a queueable class. Queueable job comes first before the Future job in the Apex Jobs. Upon checking the completion date(time), the future method is completing ...
0
votes
1answer
52 views

Why isn't my Queueable chain working?

I have the following class, none of the dependencies invoke Queueable: public class TEST_SandboxDataFactory { public static void create() { List<SObjectType> sObjectTypeList ...
1
vote
3answers
372 views

Why queuable apex accepts sobjects where as future methods doesn't?

I was going through asynchronous apex and reading it made me confused at one point. In future methods, we cannot pass sojects for reasons future methods being executed at a later point of time, by the ...
0
votes
0answers
10 views

How come my enqueued class is still getting executed in my unit test when I never call start/stopTest methods? [duplicate]

Per salesforce docs (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_tools_start_stop_test.htm): All asynchronous calls made after the startTest method are ...
5
votes
2answers
249 views

Spin locks with variable time retry backoffs

Use Case After insert triggers start Queueable Queueable execute() contends for same resource, uses spin lock to wait for resource availability. Many queueables could be running at same time. ...
1
vote
1answer
220 views

Conflicting triggers

I'm still new to Salesforce and still can't grasp regarding triggers. Scenario: My company's salesforce workspace has a managed package app installed. The managed package app has a custom trigger for ...
0
votes
1answer
496 views

Queueable Apex vs process builder and Flow

Here is the scenario: On insert of a record/records of Object - Apartment__c and conditions like Floor>7 AND Num_Of_Appt > 200(has like 4-5 conditions that should be met) , I should Query the ...