Questions tagged [asynchronous]

An asynchronous process is a process or function that executes a task "in the background" without the user having to wait for the task to finish. Typically, you will use Asynchronous programming for callouts to external systems, operations that require higher limits, and code that needs to run at a certain time.

Filter by
Sorted by
Tagged with
1 vote
1 answer
325 views

Experiencing a variable delay in HTTP Callout execution from Apex Trigger

I have built an application that has 2-way integration with Salesforce using their REST API and Apex Triggers, which send a request to my web service using an HTTP Callout when a custom object is ...
sam's user avatar
  • 113
6 votes
2 answers
1k views

PB + Queueable System.FinalException: Record is read-only

I've set up a Process (in Process Builder) which calls an invocable method, but cannot figure out why I'm getting this error: System.FinalException: Record is read-only I'm familiar with the ...
Mike's user avatar
  • 1,169
0 votes
1 answer
323 views

Test.stopTest() does not run @futureJob called from an enqueuedJob

I have a future job that is called from an enqueued job. The code works fine when I run manual tests; however, when my test class, which looks like the code below doesn't finish the future job: Test....
Jorjani's user avatar
  • 2,192
11 votes
3 answers
36k views

Error "Too many queueable jobs added to the queue: 2"

I've been looking for similar questions, but none of them applies to my scenario, so I'd be grateful if you can explain me why my logic is failing, and what can I do in order to fix it. I want to run ...
user3529582's user avatar
8 votes
4 answers
3k views

Parallel callouts in apex

On some user action, I am calling several different third party services in order to update data in salesforce. As these callouts are time consuming, I would like to execute them in parallel, and when ...
Nikola Okiljevic's user avatar
2 votes
1 answer
8k views

Solution on Calling queueable from Batch causing exception of "System.LimitException: Too many queueable jobs added to the queue: 2"

Have any one of you come across a situation, where I need to call queueable class from batch. To give you more details, let us a scenario - I have a scheduler, which will run after particular time of ...
Ysr Shk's user avatar
  • 3,034
1 vote
3 answers
2k views

Future method in trigger causes batch failures

I've recently been asked to convert a method in our account trigger to a future method to help reduce CPU errors during execution. When attempting to run all test classes in my org (for a completely ...
gNerb's user avatar
  • 9,342
0 votes
1 answer
1k views

AsyncApexJob object doesn't contain history records

We have scheduled batch classes implemented and monitoring them at the Apex Jobs page in the setup. However it seems it's showing only very recent records and when try to retrieve from AsyncApexJob ...
highfive's user avatar
  • 6,231
2 votes
1 answer
666 views

Lightning spinner doesn't show up in Promise setting

In the init() function of my Lightning component <aura:component> <aura:handler name="init" value="{!this}" action="{!c.init}" /> <c:spinner aura:id="spinner" /> ......
Robert Sösemann's user avatar
2 votes
1 answer
821 views

What exactly is "Extended Delay" in the context of Batch Apex?

Just noticed in the Salesforce Technical Library: Asynchronous Processing in Force com it says: Fair Request Handling Since all of the requests in the peek set are from a single organization (...
Matt and Neil's user avatar
1 vote
1 answer
147 views

Best way to automate checking record with specific criteria for every 15 minutes?

What is the best possible way to check record that match with my criteria and update it? i have try using scheduled jobs that run every 15 minutes but sometimes it run sometimes it doesn't run. it ...
Febrian Rizky's user avatar
0 votes
1 answer
596 views

Need help with Bulk API

I know that Bulk API is an asynchronous API. I understood Bulk API, going through the developer guide, but have a question unanswered. When a job completes or a batch completes, is there a ...
Nagesh Borate's user avatar
1 vote
4 answers
4k views

Child Lightning Component needs parent init to work. Doable without dynamic components?

When I load this Lightning component a child component's init gets a null pointer as an attribute doesn't yet exist. I is populated via an Apex action during the parent components init. I know that a ...
Robert Sösemann's user avatar
0 votes
2 answers
589 views

How to refactor Synchronous code with future method

I have a future method that is called in trigger to create some records, and after that i use the records created in the future method to associate them with other entity. Since future methods are ...
ihssan's user avatar
  • 488
3 votes
1 answer
320 views

How can I decompose a Lightning Component Helper to escape deep nesting hell?

I'm trying to figure out more maintainable ways of composing Lightning components. I'm currently looking at the helper on Display Weather Alerts in Lightning Experience, trying to break it down into ...
Brian Kessler's user avatar
1 vote
1 answer
2k views

Redirecting on user click but pop up blocker Is disabling the redirect

I have a situation where a user fills out some information and then clicks submit. When they click submit, an asynch operation gets set in motion. Once, I get a successful response, I want to ...
Chase Klingel's user avatar
6 votes
1 answer
3k views

Is a synchronous method call possible in Lightning Components?

A Lightning Component - lets call it component B - can define a method (that can have arguments) like this: <aura:method name="doAbc" action="{!c.doAbc}"/> that can be called from another ...
Keith C's user avatar
  • 134k
3 votes
2 answers
5k views

Asynchronous getContent hit org.apache.commons.httpclient.RedirectException: Maximum redirects (100) exceeded

we're having an issue with getContent() in asynchronous context, and I just can't find any way to work around it... We're exposing invocable Apex in our managed package, and one of them allow our ...
Cissou's user avatar
  • 83
17 votes
1 answer
3k views

Do Platform Event Triggers process synchronously? Do they get a fresh set of limits?

I'm intrigued by Platform Events, but I have a few questions about how they operate: Are the subscription triggers processed synchronously or asynchronously? The developer guide makes it clear that ...
Adrian Larson's user avatar
  • 148k
22 votes
1 answer
969 views

Why use Platform Events in standalone native apps?

In Summer '17 Salesforce released Platform Events - a native messaging system accessible via Apex and several APIs. I assume the main use case for such a feature is to allow integration of Salesforce ...
Robert Sösemann's user avatar
10 votes
1 answer
987 views

Are @future methods ignored in @TestSetup blocks?

Ok, this is going to become a quite long question. The main goal is to document strange platform behavior and maybe learn more why this happens. It all started with that test which failed because ...
Robert Sösemann's user avatar
22 votes
4 answers
4k views

@future runs in test without Test.stopTest() - Can that be?

For the last years I expected all async Apex means not to run in tests when there is no Test.stopTest() in my test code. But now I have a test without this call and a future method is called. I ...
Robert Sösemann's user avatar
16 votes
2 answers
6k views

Governor Limits on System.enqueueJob in Asynchronous Apex – Documentation Wrong?

Is there any execution context which uses asynchronous governor limits and allows up to 50 jobs to be queued with System.enqueueJob in a single transaction, or is Salesforce’s documentation just wrong?...
Sequoyah's user avatar
  • 760
7 votes
3 answers
420 views

Is there a clever abstraction to convert Lightning Component action responses to promises?

Coming from Angular and Ember, where making Ajax requests resulted in a Promise, I find it a little disappointing and frustrating that SFDC wants me to get back into callback hell by setting callbacks ...
Brian Kessler's user avatar
27 votes
1 answer
5k views

Dramatic increase in AsyncApexJob latency

Problem Salesforce is a multi-tenant platform and as a consequence the time for an asynchronous request to be dequeued may vary. This is not a problem for us, as long as the delays stay within ...
Sam Theisens's user avatar
0 votes
1 answer
218 views

Trigger on S2S's successfull sharing

Use case: I need to update all related opps in our org if their parent account was successfully shared through S2S (Sharing status = "Active (sent)". The account record on our side's not updated when ...
EvAzi's user avatar
  • 1,041
10 votes
2 answers
10k views

How to run an asynchronous job in developer console?

I want to find a quick way to be able to run ad-hoc pieces of Apex code asynchronously in developer console so I have higher limits. I want to be able to write and update this code quickly (no sandbox ...
Jorjani's user avatar
  • 2,192
2 votes
1 answer
1k views

Asynchronous calls from VF page to controller method

On a visualforce page that I created to upload documents, I tried to upload 500 documents at once. But it always exceeds the CPU time limit. Is there a way to invoke controller method Asynchronously ...
HEnry Li's user avatar
2 votes
1 answer
649 views

Queuable Apex - chaining jobs vs calling other classes synchronously

I'm learning Queueable apex and want to make sure I understand what the benefit of chaining jobs is, as opposed to simply calling other class methods within the method synchronously. Here's my ...
Lachlan B's user avatar
  • 313
1 vote
2 answers
132 views

Understanding persistence in @future call

I was reading about using @future and the asynchronous process and I wanted to get clarification on persistence. For example, if I have an @future method that makes a call to an endpoint in which I'...
Dman100's user avatar
  • 2,415
0 votes
1 answer
353 views

'Always Run Asynchronously' option in developer console returning 10000ms CPU time limit

Running a test class via developer console in sandbox with 'Always Run Asynchronously' option checked. Why does Limits.getLimitCpuTime() return 10000ms in this context and not 60000ms?
Lightning Evangelist's user avatar
3 votes
1 answer
1k views

Making an Asynchronous Callout from another class

I have a question regarding Making an Asynchronous Callout from an adapter class that I made in apex. Description: So i followed the Making an Asynchronous Callouts from imported WSDL guide from ...
zeev1079's user avatar
0 votes
1 answer
116 views

how to avoid Async callouts inside trigger

i have below trigger. How to separate callouts out of for loop. trigger userAttach on Attachment (after insert,before insert) { for(Attachment att: [select Id, Name, body, contenttype, Parent.Id, ...
Jack vardy's user avatar
4 votes
1 answer
337 views

Are start() methods of batches guaranteed to run sequentially?

The question is very similiar to this one: Are batch jobs guaranteed to run sequentially? I basically want to ask the same thing, except this time for start() method. Do start() methods of ...
Kamil Pilarski's user avatar
8 votes
2 answers
3k views

System.AsyncException: Maximum callout depth has been reached

I have a System.Queuable job, on a particular Sandbox that is giving me issues. It works fine on other Orgs, but fails on this particular one. The job structure is this: Batch Apex job calls System....
Phil Hawthorn's user avatar
3 votes
2 answers
1k views

Why am I not able to get full 60 second CPU time in @future method with getContentAsPDF()

I'm trying to generate a PDF, and in normal Apex execution the function is haulted due to CPU timeout (exceeding 10 second execution time). So I tried using @future annotation to use Asynchronous ...
VarunC's user avatar
  • 5,778
0 votes
0 answers
180 views

Callback on completion of AsyncApexJob

Is there a way to have Apex code execute when an asynchronous job finishes? I want to solve this problem without polling (which seems to be the dominant solution).
Mossi's user avatar
  • 3,856
0 votes
0 answers
398 views

Running Tests in Production WHILE Deploying to Production - Row Lock Error

In our test classes, we utilize testSetup methods that create and insert records in preparation for their use in the test methods of the class. I found today that if I'm running tests in Production ...
KB145's user avatar
  • 856
1 vote
1 answer
253 views

Why i cant invoke ASynchornous method before Callout?

i cannot invoke asynchornous method before Callout,how to resolve this issues? public class CalloutService { public void callout_test1() { CalloutService.doDML(); HttpResponse r = ...
F.Jony's user avatar
  • 61
2 votes
1 answer
1k views

Do outbound messages block trigger?

Based on Triggers and Order of Execution document, it is unclear at which point outbound messages are executed: 10. Executes workflow rules. <..> 19. Commits all DML operations to the database. ...
dzh's user avatar
  • 4,204
0 votes
1 answer
967 views

Asynchronous Apex Limits

I was recently trying to create a set<id> myset, and then perform around 600 .add('...id...') calls, and finally select some records based on myset values. When trying to execute it it was ...
Marc Zaharescu's user avatar
4 votes
1 answer
666 views

Keep track of chained Queueable

I'd like to insert a lot of records. Chaining Queueable classes seems to be the way to go in my scenario, I am just wondering if the following is feasible: keep track of chained jobs - when first job ...
Bart Juriewicz's user avatar
3 votes
1 answer
2k views

@future method vs Async callout

Some days ago I imported a WSDL into Salesforce and (different of some years ago) it created an Async class (and of course the sync class). So I decided to search on Google how to use this Async class....
Átila Castro Alves's user avatar
3 votes
2 answers
720 views

Performing on-demand record updates in real-time, asynchronously

I am trying to understand how the real-time mode of the Rollup Helper app works behind the scenes. I am looking for ways this can be achieved with, not necessarily how the developers built this ...
Mossi's user avatar
  • 3,856
3 votes
1 answer
2k views

Concurrent Request Limit Exceeded - Possible Solutions

In the recent past we've replaced two very old s-control type and html mashups with visual force pages and web services. This changes along with a few other visual force pages built into our standard ...
KcBrewRon's user avatar
2 votes
2 answers
511 views

About using Test.startTest() / Test.stopTest() for batch execution testing purposes

just right now, while deploying some code from Sandbox environment to the Production one, I was noticing something strange within a test class that should have the aim to test a Batch class. I notice ...
user avatar
3 votes
1 answer
2k views

Testing multiple asynchronous processes

I have a test that for it's data setup I need to fire multiple asynchronous processes. I have a suspicion, that they do not finish sequentially one after another. I think Test.startTest()/Test....
dzh's user avatar
  • 4,204
10 votes
0 answers
785 views

Implement Domain Event Pattern in Apex - can and should it be done?

In Domain Driven Design a single pattern is drawing a lot of attention to itself - Domain Events and Event Queues. (slide via http://de.slideshare.net/andysal/never-mind-the-bollocks-heres-the-domain-...
Robert Sösemann's user avatar
2 votes
1 answer
476 views

The future of Async Apex - everything Queueable?

I know that this is a somewhat opinion based question but there is definitely interest in the community in where the Roadmap goes. Do I get the blogs and communities and blogs right that we are ...
Robert Sösemann's user avatar
2 votes
1 answer
2k views

Apex Batch Job not processing all batches

I have an apex batch job, to query all closed cases older than 13 months. I have implemented the Stateful interface to that I can accumulate all the rows over the several batches that will execute. ...
cloudy-ritz's user avatar
  • 2,563