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
-2 votes
1 answer
2k views

How to solve read time out error in Apex callout?

Hi all and thanks for reading Got this code: public class SendingZabbixServices{ @future(callout = true) public static void zabbixDoPostFuture(String jsonString, String endpoint){ ...
Nacho Zve De La Torre's user avatar
0 votes
1 answer
186 views

CalloutException: you have uncommitted work pending - without DML? [duplicate]

I want to test a Queueable class that makes callouts to an external system. I'm baffled because I keep getting uncommitted work pending exception. My execute method queries custom metadata, constructs ...
user682217's user avatar
  • 1,171
1 vote
1 answer
357 views

Working with large data volume

I have a design question and I want an expert opinion from the group. Here is the use case: Whenever there is any update on the Booking record (let's say change the status to "Cancelled"), ...
Noob_NoVoice's user avatar
  • 2,709
0 votes
1 answer
983 views

Apex Job Execution - Multiple @future Methods in the Same Transaction

Could you please help me with the below queries related to Apex Job Execution: If multiple Async request(future methods) are fired in the same thread, it makes the Async job request status as Queued ...
Saurabh's user avatar
  • 27
0 votes
1 answer
136 views

Cannot retrieve the property value in JavaScript from Apex controller after making the call to the web service

I'm trying to retrieve the boolean value for the property from my controller. This value is being assigned after the call to the web service like this: public Static Boolean myVariable { get; set; } @...
heisenberg's user avatar
0 votes
1 answer
404 views

Is there is good way to send an email to a user after 5 minutes of inactivity on an Account?

An indeterminate number of images will be attached to Lead records. We have a requirement that 5 minutes after the last image is attached, the Lead owner should automatically receive an email. I've ...
Brian Kessler's user avatar
0 votes
0 answers
416 views

How can I access a High Assurance Session in an Async Apex context?

Has anyone worked with a high assurance session requirement and async apex? I need to query the Security Health Check objects during an async process (the query happens in a queueable). If "View ...
Toby Curtis's user avatar
3 votes
1 answer
61 views

Is Lead.Name 100% predictable?

We have an integration with a third party site which requires an exact match for the Lead Name. When we have a new lead, we need to make a call out to this website. In Trigger.new, Lead.Name is always ...
Brian Kessler's user avatar
0 votes
2 answers
50 views

Design to run a batchable after a trigger and account for multiple workflows

Our current design starts from a trigger, checks the data against a bunch of rules that the customer sets up. The ones that pass get sent to another job which exports it to another external system ...
J. Larson's user avatar
1 vote
1 answer
528 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 ...
Douglas's user avatar
  • 45
0 votes
2 answers
2k views

Making Callout from Apex triggers [duplicate]

I have a Apex Trigger which makes the callout to the External system when a field in a record is updated. The Apex Trigger and the Callout method are like below trigger updateLocation Account (after ...
user81642's user avatar
  • 667
0 votes
1 answer
62 views

Gack on Apex Jobs page - Status Detail column for certain jobs

Wondering why my Queueable failed with: Salesforce System Error: 1380510393-83097 (1289245132) (1289245132) as shown on the Apex Jobs page No email sent to Apex Exception email address; no limits ...
cropredy's user avatar
  • 69.1k
0 votes
2 answers
327 views

Facing CPU time limit error

Weekly about 10,000 records are inserted and there is a Trigger that calls a class to process these records. All this process is synchronous, but for some cases it's taking too long to process and ...
A Louis's user avatar
1 vote
1 answer
1k views

Unit testing Schedulable that calls future method

This has been asked here and here, but I'm not satisfied with the answers. Hoping to gain a better understanding of this. In working through the Apex Specialist Superbadge, the callout portion of the ...
Matt's user avatar
  • 13
1 vote
1 answer
582 views

Shared Static Variables between Triggers and Async Operations

When sharing Static Variables between a Trigger Context and an Async Operation such as Batch Apex, is it possible for there to be a conflict between the two? For example, say I have a Trigger that ...
02384705287409872098374's user avatar
4 votes
2 answers
2k views

In an unit test for an LWC, how can I prove an async chain is setting a value in a lightning-formatted-number?

I am trying to prove that the price is being set on the component. I have the following HTML: <template> <h1>Current price of a bitcoin in Euro</h1> <lightning-formatted-...
Brian Kessler's user avatar
0 votes
0 answers
10 views

Why in this code these variables aren't changed in batch? [duplicate]

Variable flagForTest is false and variable count is 10 but they should be: true and 100. Debugs in batch show correct values, debugs in test class or invoked in Anonymous Apex show incorrect values. ...
NickName43's user avatar
0 votes
1 answer
37 views

How can I make sure that block of code in unit test will be runned after batch ends - not before or during test?

I need to run batch (or something else which will process big amount of records) and after this branch I need to invoke System.assert(booleanVariable); How can I do this? Batch need to execute and ...
NickName43's user avatar
1 vote
1 answer
1k views

Testing a Future Method that Schedules a Class - Test.stopTest() Does NOT Run Both Synchronously

I have a class with an @future callout method, and that future method schedules an instance of another class which also makes a callout. In effect, if the first callout is successful, it schedules ...
number41's user avatar
  • 918
8 votes
1 answer
9k views

How to wait for imperative apex call from a LWC to finish running before executing next line?

I have two methods seen below, the first method is a wired call: @wired (firstMethodCall, {param1: 'test'}) wiredResult(result){ console.log('1'); this.secondMethodCall(); ...
user2821694's user avatar
0 votes
1 answer
842 views

Want to create Record in batch class and there is no record to query in start method

I had one batch class in which i am passing some data required for creating object record.But when i call that batch class from parent class variables are initialized but start method are not called ...
Paresh Patil's user avatar
0 votes
0 answers
133 views

Adding remoteSite settings dynamically from postInstallScript

I checked this link to add remoteSiteSettings dynamically. Above link suggesting to add visualforce base url to remote site setting first. I am able to insert that without any issues from synchronous ...
AshSFcloud's user avatar
0 votes
1 answer
899 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 ...
wesaw's user avatar
  • 2,980
0 votes
1 answer
146 views

Will Soql written in Database.querylocator(query) will count against the total governor limits

global Database.QueryLocator start(Database.BatchableContext bc){ List<Case> cstlist = new List<Case>([select id from case limit 10]); System.debug('this is the query limit ...
Vineel's user avatar
  • 55
0 votes
1 answer
193 views

Deleting Scheduled Job versus Aborting job?

What will happen if the scheduled job is deleted and what happen if it is aborted. Do we have any significant difference
Vineel's user avatar
  • 55
0 votes
0 answers
302 views

AsyncSaveCallback not working in apex

I am trying to insert records to an external object and get the Id back for the inserted record I have the following piece of code Database.SaveResult[] insertResultAccount = Database.insertAsync(...
Madhurima's user avatar
  • 1,235
-2 votes
2 answers
48 views

Batch versus Future ? which way should we prefer in below requirement? [closed]

We have 100 account records ,we need to send the each of account record to make call-out. Which would be preferable and why ? If future is not preferable and why ? We can do call outs making batch ...
Vineel's user avatar
  • 55
3 votes
1 answer
1k views

LWC: Second async child function call fails

I would like to call an async function on a child component from its parent. This works the first time I call the function, but the second time, I get a "Sorry to interrupt" error with this:...
Matthew Souther's user avatar
0 votes
1 answer
140 views

Webservice is allowing duplicate record creation

I have below piece of code in web service apex class. If account is found with given emailId then I am updating the account, if account is not found with emailId then I am creating new account record. ...
Jagadeesh's user avatar
1 vote
1 answer
905 views

Testing Apex Trigger with Asynchronous HTTP Callouts

I have an apex trigger f_contactPushNotificationTrigger that should fire when a new contact is created. This trigger call f_PushNotification class used to Post data. I used @future to make this task ...
MRDRAG's user avatar
  • 21
0 votes
0 answers
1k views

Why is SerialBatchApexRangeChunkHandler more than the number of batches?

I am working on batch apex and I have just tried writing a simple code for learning purpose. In the start method I am querying the records limiting them to 7, and I am running the batch job from the ...
Ayush Goyal's user avatar
1 vote
2 answers
7k views

How to use Promises / synchronize two asynchronous methods in Lightning Web Component(LWC)?

In LWC JS, I am making an external API call-out and an Apex method and accumulating the results. How to synchronizes the process? Example: renderedCallback(){ let a,b; getApiResult().then(...
Daniel Deepak's user avatar
3 votes
1 answer
6k views

How to check if future method has executed

in my apex code I need to do some calculation only when future method has executed I tried below code to check if future method has executed: public static void anotherMethod() { while('Completed' != ...
gs650x's user avatar
  • 2,560
2 votes
0 answers
325 views

Report Rest API (asynchronous run and excel export)

I'm trying to use Report Rest API to filter and export some of my reports. My first approach with synchronous report runs works pretty well, but I bumped into 500 batches' run per hour limitation. I ...
azimut3's user avatar
  • 120
12 votes
4 answers
1k views

Run more than one async jobs from Future/Quable context

We have created a process which must work asynchronously (limits and architecture reasons) and it was working fine. Some time later we have started to work with BigObject. And as long as writing to ...
Mattue's user avatar
  • 123
2 votes
1 answer
100 views

Need advise on callouts and inserting/updating new records from external system

We have an external application where few records gets updated or created on daily basis. We already implemented inbound calls to salesforce but it is scheduled for once a month. We need to schedule a ...
AshSFcloud's user avatar
1 vote
1 answer
40 views

how quable solves the problem of having soobjcets in future mthods?

As per my knowledge both future and quable are async methods ,we don't know when they run,that's y we cant pass sobjects as parametrs in fuute methods(i read in future trailhead) because objects state ...
Ganesh Thota's user avatar
-1 votes
1 answer
240 views

Continuous integration using REST api in vf page

I have been asked a question in continuous integration. First let me give some background. In continuous integration api call we can call 3 webservice urls at a time and process response in another ...
Deepak Agarwal's user avatar
1 vote
1 answer
620 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 ...
Manish Khade's user avatar
-1 votes
1 answer
755 views

Future method use response to make update on Opportunity object

I have a future method where I make an external REST api call which gets kicked off in an after update trigger on the Opportunity object. When the results come back, I deserialize the JSON and then ...
user1669296's user avatar
2 votes
1 answer
520 views

RequestAnimationFrame in LWC

I'm implementing a pretty straight-forward animation in LWC (Lightning Web Components). My normal approach to doing animations within JS is to use requestAnimationFrame, but the linter rules in LWC ...
Mattisdada's user avatar
  • 1,071
0 votes
3 answers
1k views

Can Queueable run in parallel with calling transaction?

SimpleQueueable.cls: public with sharing class SimpleQueueable implements System.Queueable{ public void execute(System.QueueableContext ctxt){ //query the record inserted in calling ...
javanoob's user avatar
  • 8,767
0 votes
0 answers
331 views

Finding out when lightning-record-form has finished rendering?

I have a LWC which displays the Compact Layout as a popup in a graph using lightning-record-form. The LWC holds a <slot> in which the popup-lwc has the record for like so. <template> &...
PhilippUp2Go's user avatar
3 votes
1 answer
88 views

Does the FOR UPDATE field apply to reference fields?

If do a query like [SELECT Opportunity.Name, Product2.Name FROM OpportunityLineItem FOR UPDATE], is the Opportunity and Product2 locked, or just the OpportunityLineItem? I'm trying to set a field on ...
just_chilling's user avatar
4 votes
1 answer
1k views

Avoid new record race conditions with FOR UPDATE [closed]

Under simple circumstances FOR UPDATE does only respect records that existed when the query was executed. But I need all available records matching my query when the transaction proceeds. Let me ...
itsmebasti's user avatar
  • 6,349
0 votes
2 answers
793 views

Get ApexJobId from Future method

Is it possible to get the ApexJobId within the Future method apex code (or from the method its invoked from)? Use case - Our application is invoking multiple same future calls from within one apex ...
Sidharth Agarwal's user avatar
1 vote
1 answer
278 views

How come Queuable apex accepts sobjects where as future methods doesn't? [duplicate]

As we know we cant pass sobjects to @future method due stale of data during the processing time,where as not same in case of Queable apex.How exactly its working by using Sobjects here?
SUresha Shettigar's user avatar
2 votes
1 answer
1k views

How to tell my lightning web component the data has been loaded through a mix of imperative and @wire operations

TL;DR whats the best way to tell a page that the underlying data has loaded through a mix of imperative calls and wire calls, preferably without chaining .then functions Long Version: I have 4 async ...
TemporaryFix's user avatar
  • 2,867
0 votes
2 answers
403 views

System.isScheduled() not working in Scheduler/Batch

I have a Scheduler class which executes a batch class. I also execute this batch class from a VF page. Deep down in the class hierarchy, I want to check if this batch was called from a Scheduler or a ...
d_k's user avatar
  • 1,291
4 votes
1 answer
588 views

Change Data Capture vs Queueable Apex

With the introduction of Change Data Capture, now there is one more way to execute Asynchronous Apex. What are the advantages of Change Data Capture over Queueable Apex? How Salesforce will enqueue ...
Devendra's user avatar
  • 5,057

1 2
3
4 5
7