Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
2answers
71 views

How do static and member variables behave in a. stateful batch classes?

Suppose I have a batch job and I want to maintain state (i.e. want to keep a log of the record ids that I've processed, or keep a running total, or something). When would I use class variables vs. ...
0
votes
0answers
30 views

Getting status null in apex continution callouts

I am getting this response for all urls System.HttpResponse[Status=null, StatusCode=200] in my continution object Here's my code public with sharing class ContinuationController { // Unique ...
1
vote
0answers
17 views

Custom component taking long time to load

I'm having a record page with an heavy custom components. By heavy I means like 20 seconds of loading time. I'm trying to find a way to load it asyncronously without blocking the UI of the User. ...
5
votes
1answer
101 views

How do I test asynchronous Apex?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
0
votes
1answer
96 views

Exception in @Future Method - System.QueryException: Record Currently Unavailable

I am facing error in one of future method (calling from trigger handler). This error occurs when integration event submit these record in bulk but when i am doing this from UI i do not get this error. ...
5
votes
2answers
183 views

Enforce Batches (whole run, not single jobs) to wait for each other

A few situations in my app trigger a Clean up batch to run. It will process many records. In some situations multiple of such Cleanup batches will be triggered by independent user operations. If the ...
-1
votes
2answers
64 views

Design Patterns for Asynchronous Apex

Background After listening to Dan Appleman's talk: Dreamforce 13: Design Patterns for Asynchronous Apex I went to look at the code: Sample Code: Design Patterns for Asynchronous Apex ...
2
votes
1answer
69 views

Platform Events + Process Builder + Apex with @future method

I'm running into an issue with too many future calls when handling Platform Events with a Process Builder that uses an invocable Apex class. Basic setup is 2 processes: The first publishes an event ...
3
votes
1answer
377 views

Custom Logging and Future Methods

I have been reading up on the custom logging, DML, and exceptions but haven't seen anything that talks about @Future methods and exceptions. I have two scenarios: A Button is clicked on a Lead, ...
1
vote
1answer
29 views

Initialize jQuery plugins with ui:outputRichText in Lightning component

I have a Lightning component that displays record's content as rich text. The content contains HTML code and I need to make it work with jQuery on click handler and some plugins. The content comes ...
0
votes
3answers
60 views

Is asynchronous apex either rolled back or not executed if the original transactions fails?

I would like to confirm the behaviour of asynchronous apex when an error occurs on its original/parent transaction. Imagine we have a synchronous apex transaction (Transaction1-Apex) that launches a ...
1
vote
2answers
59 views

Can Salesforce Platform Events be Relied on as an Async Solution?

Recently I was working on a project where, in order to deal with recursion and governor limits, the previous developer decided to send Platform Events, with the expectation that the very same ...
0
votes
1answer
66 views

Issues in Scheduled Apex

Error:First error: Delete failed. First exception on row 0 with id a2A0R000003T2DMUA0; first error: ENTITY_IS_DELETED, entity is deleted: [] Note: Above error occurs to me as a concurrency Issue. ...
0
votes
1answer
34 views

What async notification options are available in OOB LEX UI?

I have created a trigger that validates user input against a web service after insert/update. Originally, I wanted to show a validation error on the data entry screen, but this is not possible due to @...
2
votes
2answers
72 views

Queueable Apex consideratoins

This is more of a theoretical question and probably goes more to design and I hope I can do this justice. I have successfully coded in apex multiple triggers which make callouts using the @future (...
1
vote
1answer
54 views

Execute Javascript on VFP from Controller Query Results [closed]

I have a Visualforce Page with inputs, these input values are passed to a controller, query results are returned, and results are displayed in a datatable on the same VFP with inputs. If the list I ...
-1
votes
2answers
42 views

Calling one asynchronous apex from another [closed]

Can anyone provide me when we can call an asynchronous apex from another specially between when they are not of same type like schedulable from future or batch from schedulable,etc
0
votes
0answers
25 views

CloseTab Callback Function not Executing

Callback function is not executing in console tab method closeTab, but the id provided to the method IS closing. Why? function callback (result) { console.log('in callback'); }...
1
vote
1answer
55 views

Synchronizing force:recordData and external JavaScript library on loading

I've got situation in lightning component where on init there should be used data from two sources: record loaded via force:recordData data from this record parsed with use of external JS library ...
0
votes
1answer
28 views

External Application receiving multiple Success Pings

For the SFDC Integration I send out a call to an external application and receive a Success status in my debug log(I am logged in as myself). External application says they are getting multiple pings ...
0
votes
1answer
38 views

What is the execution context for an asynchronous method?

Is it always system context, or it depends on where the method is called?
2
votes
2answers
539 views

What's the difference between AsyncApexJob and CronTrigger?

Roughly I know that when I schedule a Schedulable, I'm creating both a CronTrigger and an AsyncApexJob, but I'm confused as to how the two objects relate to each other and what the significance of ...
1
vote
0answers
217 views

Apex Continuation - Response Method

I am using Apex Continuation to make a callout from a VF page, but the response method is not being executed and, as a result, no response is displayed on the page. Can anyone please see why this is ...
1
vote
1answer
250 views

Best way to add a progress bar to indicate loading?

I've got a complex process that takes about thirty seconds to execute, depending on how many records are in the org. I can estimate the completion percentage by iterating a count variable in my for ...
1
vote
1answer
87 views

Error while opening PDF document created through Future method

I have a webservice class 'restExample' which first performs DML operations and then calls a future method 'createDocument()'. This method will create PDF document. One important point: Running user ...
2
votes
2answers
150 views

Asynchronous Apex-->Future Method challenge

I am doing the challenge for 'Asynchronous Apex-->Future Method' module and have written following apex classes: public class AccountProcessor { @future public static void countContacts (List&...
-2
votes
1answer
60 views

Help in writing Asynchronous Batch Apex to avoid governor limit of 150 records

I have a function that has the DML operation inside the for loop due to which I am running into governor limit exception of 150 records. I read about batch apex on Salesforce discussion about not sure ...
10
votes
2answers
224 views

Guarantee only a single asynchronous job runs at a time

This is a bit of an odd one. We are interacting with an external system that does not support concurrency due to a bug which they are struggling to fix. We perform a HTTP callout, the callout takes ...
5
votes
2answers
2k views

Callout Limits for future methods and queueable apex

I'm aware from the docs that "A single Apex transaction can make a maximum of 100 callouts to an HTTP request or an API call." Is anyone aware if that limit is higher in a future methods or ...
0
votes
1answer
51 views

Cache value not being saved in Org from Async call

I have a batch call that calls a queuaeble that calls a future call which utilizes a visualforce page 'getContentAsPdf' function. Also in this queuable call I set a custom class value to a local ...
-1
votes
2answers
57 views

SOQL Query on PricebookEntry returning no rows

I'm trying to create a queueable apex class which will update the unit prices of all Products (on all Pricebooks) based on newly updated exchange rates. I'm able to successfully query on ...
0
votes
3answers
171 views

Getting the job id of a chained job from the id of the parent job

I have a Queueable job that will initiate a Batch job. I have a transaction that enqueues the Queueable job and returns the id of the Queueable job. However, I need to be able to get the id of the ...
1
vote
1answer
262 views

How is calculated “24-hour period” for the limitation of Asynchronous Apex Executions

I have a question regarding Execution Governors and Limits for daily maximum number of asynchronous Apex method executions. In the Salesforce documantation it is written, that the maximum number of ...
0
votes
1answer
21 views

Pitfalls or risks in having a scheduled job run every 1 minute

I've got a requirement to know which Contacts are associated to Open Opportunities, and it needs to be known very quickly upon OpportunityContactRole creation. As we all know, OpportunityContactRole ...
2
votes
1answer
50 views

Short delayed (asynch) related record updates

I feel like there should be a straightforward answer here, but I'm coming up short... Trigger event: Account lookup field on Lead(s)/Contact(s) are updated OR a particular Account field is updated ...
1
vote
1answer
65 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 ...
4
votes
1answer
285 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 ...
0
votes
1answer
37 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....
3
votes
3answers
1k 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 ...
5
votes
4answers
365 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 ...
1
vote
1answer
156 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 ...
1
vote
3answers
269 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 ...
0
votes
1answer
132 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 ...
2
votes
1answer
238 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" /> ......
2
votes
1answer
180 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 (...
1
vote
1answer
38 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 ...
0
votes
1answer
104 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 ...
1
vote
4answers
1k 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 ...
0
votes
1answer
65 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 ...
3
votes
1answer
154 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 ...