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
6 votes
2 answers
594 views

How to mix getContentAsPDF calls with DML?

This critical update: PageReference getContent() and getContentAsPDF() Methods Treated as Callouts will be auto-activated in January 2016. We have some code that uses a queue of custom event ...
Keith C's user avatar
  • 134k
3 votes
1 answer
1k views

Why does my ActionPoller wait for my batch process to be done before it polls?

I have a CommandButton that calls a method in the controller that starts an Apex batch processes. I have an ActionPoller that is supposed to get the current progress of the batch process and update ...
Neo's user avatar
  • 775
5 votes
2 answers
2k views

Do asynchronous methods run in parallel?

The short question is - do future methods run in parallel, or sequentially? I am wondering if race is possible in Salesforce. Let's say We've got some singleton class S that we want to call from some ...
Bart Juriewicz's user avatar
1 vote
1 answer
408 views

Handling Asynchronous Responses from Box.com

I'm using the Box Toolkit for Salesforce. As you know, in Apex I have to make asynchronous calls to Box. My problem is that sometimes when am performing multiple operation, such as creating a folder,...
Mitch's user avatar
  • 33
4 votes
1 answer
1k views

Testing the ACTUAL batchable context in Database.Batchable methods?

I'm trying to mock Database.BatchableContext to make my unit tests more robust and to eliminate excess usage of Test.isRunningTest() running in production code. Few hacks are available like Json....
Matt and Neil's user avatar
5 votes
1 answer
2k views

Are aura:waiting and aura:doneWaiting component specific events?

Good afternoon everyone, I have a question regarding the use of the aura:waiting and aura:doneWaiting system events. I currently have two nested child components within a container component as you ...
Daniel Fuller's user avatar
1 vote
1 answer
2k views

How to find out the Send Id and Batch Id of an Asynchronous TriggeredSend

Disclaimer: I'm new so I may not have the terminology down. I'm including links to the documentation on the Exact Target site regarding the APIs we are using. We are using Asynchronous Triggered ...
Gir's user avatar
  • 31
1 vote
1 answer
207 views

Fuel Java SDK - Asynchronous Triggered Sends

Are asynchronous triggered send calls possible using Fuel Java SDK v1.0.3?
Tom Wagner's user avatar
0 votes
1 answer
96 views

Document upload parallel through Apex - Design review

I am doubtful whether I am going in the right direction. My requirement is to upload all the documents from Salesforce to my local storage space. I have a button that triggers the following function: ...
dmachop's user avatar
  • 1,089
2 votes
1 answer
2k views

Update VisualForce Page field after Apex future callout

Want to update a VisualForce Page once my @future Apex Callout is done. How can I update a VisualForcePage, once the Webservice callout is done? Could I somehow divide the SearchCRM method, so that it ...
Claus Machholdt's user avatar
0 votes
1 answer
321 views

PHP Fuel SDK - Sending TriggeredSend Asynchronously

It does not appear that I can send an asynchronous TriggeredSend call to the system with the PHP SDK. Am I missing something? I can add Priority to the props which gets attached to the ...
ModernDeveloperLLC's user avatar
1 vote
2 answers
4k views

How to synchronize asynchronous Apex

There are different ways to offload long-running processes to asynchronous apex: we got future calls, scheduled Apex, batch Apex and, more recently, Queueable Apex. They are all good to launch "fire ...
mkorman's user avatar
  • 3,986
2 votes
1 answer
1k views

"Cannot execute the continuation for Web Service calls" error when using an Asynchronous Callout

Working through a quick example of using a Continuation to make an async web service callout produced the following error after pressing the apex:commandButton that called the action returning the ...
Daniel Ballinger's user avatar
3 votes
4 answers
5k views

Asynchronous Callout from an Imported WSDL

I developed VisualForce page with asynchronous callouts to web service according to link. It is working fine, my page is showing results after callback is returned. I really like pattern with ...
mischczu's user avatar
  • 329
0 votes
1 answer
2k views

Governor Limits for Asynchronous Methods

I am aware that async apex methods have higher governor limits. Can someone let me know how "higher" the gov limits for a Async job is ..some kind of numbers or reference link would be great. If a ...
KVN's user avatar
  • 3,053
3 votes
1 answer
339 views

Continuations (Async Web Services) in Spring 15 Sandbox [closed]

According to Spring 15 release notes, Continuations class should be available in Spring 15. I have a preview Sandbox (on CS21) but this feature does not appear to be enabled as the Apex does not ...
John Davies's user avatar
12 votes
1 answer
3k views

Testing scheduled apex containing @future method?

I've seen plenty of posts and documentation on testing asynchronous apex in general, but what about code with multiple layers of asynchronous code? Specifically, I have a scheduled apex class which ...
smohyee's user avatar
  • 3,682
6 votes
2 answers
2k views

How can my code tell if it's inside a Queueable context?

To go with the new System.Queueable interface, I'm looking for the analogy of: System.isBatch() System.isFuture() System.isScheduled() Is there a System.isQueued() or something?
Matt and Neil's user avatar
27 votes
4 answers
26k views

Can Queueable solve "Future method cannot be called from a future or batch method"?

I have code that must be called as @future as it requires all the resources one can get. The only problem is that in 1% of the cases this code is called from a Batch and therefore fails with System....
Robert Sösemann's user avatar
36 votes
10 answers
2k views

How can I cause side effects outside an execution context?

I've got a scenario that relies on the system's "automatic rollback" behaviour to undo any DML, emails, futures and so on, in the case of an error. Basically, by allowing code to throw an unhandled ...
Matt and Neil's user avatar
4 votes
1 answer
293 views

Using @future tag on Apex Webservice but code not executing asynchronously

With the winter '15 release over the weekend some mission critical code for us is now getting the infamous "Apex CPU time limit exceeded". It worked fine for the past 8 months until this release. (as ...
StartingAgain's user avatar
1 vote
1 answer
257 views

FTP SSL documentation for Batch File Export (Bulk Async) Call is wrong. Can't get it to function

Output for a Batch File Export (Bulk Async) Call is Below is what we are finding in trying to make use of this: The documentation for enabling FTP SSL does not work. Documentation Link: http://...
Stephanie Moffett's user avatar
6 votes
2 answers
1k views

How to test @future methods with setup objects and avoid MIXED_DML_OPERATION

I’m in a situation where I have to use a future method to avoid MIXED_DML_OPERATION error. I have a trigger that runs after INSERT on USER and creates a custom object X. They are in 1:1 relation. ...
user682217's user avatar
  • 1,161
2 votes
1 answer
619 views

Async Apex & Fault Tolerance

Trying to see if I can make Async Apex jobs fault tolerant; meaning if they fail can I implement some sort of retry logic? What would this retry mechanism look like and is there any documentation or ...
Venkat's user avatar
  • 45
3 votes
1 answer
167 views

Invocation of scheduled class : starts - schedules - completes without a trace. No debug log

I've got an Apex Class that implements System.Schedulable which I'm trying to run: public class Broker { //... public class Worker implements System.Schedulable { public void ...
Matt and Neil's user avatar
6 votes
3 answers
4k views

How to estimate how long a given batch will run?

Are there any reliable numbers, heuristics, experience reports to estimate (and display it to the triggering user) how long a given batch will run? Sure the time will mainly depend on the number of ...
Robert Sösemann's user avatar
8 votes
3 answers
3k views

Can a DML retry solve UNABLE_TO_LOCK_ROW race conditions?

I have 2 Batch classes working on different child objects of a common master object. Batch Batches are started parallel to speed up this long running cleansing operation. It depends on the underlying ...
Robert Sösemann's user avatar
4 votes
1 answer
3k views

System.AsyncException: No enclosing class for method: methodName

I have this error that says "System.AsyncException: No enclosing class for method: methodName". The code structure : trigger trgSendRecords on DataSetup__c (after insert) { /* SOME BUSINESS ...
Mohd Nadeem Shaikh's user avatar
1 vote
1 answer
1k views

Asynchronous Calls: Order Of Execution In A Test Method

Imagine the following scenario: Trigger myTrigger on User calls a future method which flags Account records. Then a Batch Job must run to process the records. While testing, I am first inserting ...
ManSpan's user avatar
  • 1,378
11 votes
2 answers
14k views

What does the Batch Apex "Holding" status mean and where is it documented?

I've seen the following values in the AsyncApexJob table during the 'cradle to grave' life cycle of a Batch Apex job: BEFORE running: Queued Preparing WHILE running: Processing AFTER running: ...
Matt and Neil's user avatar
5 votes
1 answer
4k views

How can I get the details of last schedulable job and of which class? Is there any way?

I have a requiurement where I have to get the details of last job details and the Of which clas s. How can I get the details ? i have tried using CronJob details and CronTrigger?
AnkushSalesforce's user avatar
7 votes
1 answer
3k views

Do triggers run asynchronously when triggered by DML in apex?

The question is fairly self-explanatory, but to add a little background, here's the scenario that has made me ask. First a (very basic) SSCCE: public void createAttachments(List<Account> ...
DaveyDaveDave's user avatar
5 votes
1 answer
1k views

How can I synchronize processing in Apex?

I have a custom Object TaskEvent with an Event Type and a Task ID Throughout the life-cycle of the task I will receive events such as Start Event Routing Event End Event I receive a web request ...
ScArcher2's user avatar
  • 182
15 votes
1 answer
12k views

Using Batch Apex on millions of records

Part of our app behaviour is going over millions on records and updating their data. From what I read, we can do it using Batch Apex although I am not certain I fully understand how it works. Here ...
Uri Lukach's user avatar
  • 1,254
4 votes
1 answer
940 views

Batch execute is slow because of huge unused gaps in DevConsole timeline

I have a long running batch that is taking days to execute and creates millions of records. To speed it up I used the profiling tools of the Developer Console. Per batch execute() I see this timeline ...
Robert Sösemann's user avatar
3 votes
0 answers
351 views

Why does this Batch always and only abort in Production?

I have a long running asynchronous process that process millons of records in a CustomObject__c. To prevent other limits we have split this into 2 Batch classes that work on this table in parallel. So ...
Robert Sösemann's user avatar
2 votes
2 answers
1k views

Why do batches behave different in Production than in a Sandbox

Recently I observed serious and undocumented differences in the runtime behaviour of Sandbox vs. Production orgs, e.g.: Batches (same code, same data) run faster in the Sandbox Same Batch in Sandbox ...
Robert Sösemann's user avatar
4 votes
1 answer
3k views

Does Test.stopTest() cause ALL waiting asynchronous functions to fire?

For practice, I'm composing on a unit test for a Schedulable class: /** * Example of scheduling Apex Batch Processing * @see Apex Workbook, page 68 **/ global class WARE_CleanMerchandiseScheduler ...
Brian Kessler's user avatar
5 votes
3 answers
533 views

Tracking errors in batch impossible as Dev Console stops logging or breaks with Server error

When single batch jobs fail only the last one is party shown in the Apex Logs page. This is not enough for debugging. A better way ist to check the log entries that are written per batch execute. ...
Robert Sösemann's user avatar
4 votes
1 answer
293 views

Is there any way to unit-test that a function will run into a LimitException?

I need to write a test that verify that a function call is run synchronously. As I have found no elegant way to find that out I now let my function run into a Limit which is an indirect proof that ...
Robert Sösemann's user avatar
8 votes
3 answers
2k views

Build Custom Batch Queue to centrally manage Batches & circumvent the Max. 5 Batches in parallel

Just assume you had an app that would have to process huge amounts of records in an org in multiple ways each day. For each "way" you have a separate Batchable class and those are triggered ...
Robert Sösemann's user avatar
6 votes
3 answers
2k views

How to best structure code so it can be run synchronously and in Batch

This question is somewhat related to my other open question on the asynch/synch topic. Assume I would have an algorithm that could tell me that for a given customer org (data volumes and other ...
Robert Sösemann's user avatar
2 votes
2 answers
1k views

Button redirects page before async call is finished in another field

I am really confused as to how to solve this issue I have on a visualforce page. Basically I have a pageblock table with some Opportunity Products displayed. On the onchange event of the fields in the ...
Mauricio's user avatar
2 votes
1 answer
171 views

Heuristics to decide if to run an operation sychronous or asynchronous

Im our app we recently had to switch many operations from short running synchronous calls to asychronous Batch or future calls. It helps us overcome the many limits but also introduces many other ...
Robert Sösemann's user avatar
6 votes
2 answers
2k views

Rerender apex:details after DML async method call

I have found a strange behaviour and I can't find why does it happening. I have custom object Test2_c with custom text field Status_c. I want to change it's status asynchronously, so I prepare a VF ...
dpedro's user avatar
  • 171
0 votes
1 answer
872 views

ActionFuntion Rerender in VF page leads to sudden "Insufficient Privileges" - even as Admin

To make a VF component appear to load faster I used an actionFunction to load it only after the rest of the pages has loaded (jquery's document.ready). After doing this my component showed an "...
Robert Sösemann's user avatar
1 vote
1 answer
2k views

Examples of using queryAsync in SOAP API?

I've been looking around online for examples for using queryAsync() in the SOAP api, but I can't seem to find any. Can someone using Async calls using the SOAP WSDL api in C#?
RJP's user avatar
  • 177
3 votes
3 answers
3k views

JavaScript Remoting on Standard Page Layout

I have a couple of JavaScript remoting functions used to count records and to display that count to the end user. The JavaScript remoting functions are on a Visualforce page, and the Visualforce page ...
Tony H.'s user avatar
  • 206
15 votes
3 answers
1k views

Batch Apex in AppExchange package and orgs with related triggers that call @Future methods

Here's the problem: when an org has a trigger that calls an @Future method, any batch Apex that fires that trigger will fail, since you cannot call an @Future method from an @Future method OR from ...
Adam's user avatar
  • 4,298

1 2 3 4 5
6