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

Test coverage for finish method in Batch Apex with a chain class

I wrote a test class for a Batch Apex Class that has a chain of another class in the Finish method. I tried the following approach, but it still does not cover the lines in the Finish method. Is there ...
Argen Turatbek's user avatar
1 vote
0 answers
234 views

Does each chunking of a batch goes through the same process of Queued, Processing and Completed states?

As per documentation : The maximum number of asynchronous Apex method executions (batch Apex, future methods, Queueable Apex, and scheduled Apex) per a 24-hour period For Batch Apex, method ...
Nagendra Singh's user avatar
3 votes
3 answers
1k views

Promises in Apex?

We have a very complex scenario where we have multiple external systems that we interact with and we need to make sure the data is valid across multiple external systems before it gets processed ...
jojopogi's user avatar
  • 484
0 votes
1 answer
135 views

I am getting FATAL_ERROR System.QueryException: unexpected token: BM_DPM_Date__c

I am facing the following issue. I wrote this query for the start method of my batch class. global Date startDate; global Date endDate; global Date currentDate; global Database.QueryLocator start(...
Argen Turatbek's user avatar
2 votes
2 answers
2k views

Does Platform Event / CDC uses same Async queue as Queueable/ Future?

We have a huge concurrent influx of incoming custom api requests. (1000+ under 5 seconds approx) Because of this we were getting ConcurrentPerOrgLongTxn Limit exceeded. We moved from Sync processing ...
Nagendra Singh's user avatar
2 votes
2 answers
302 views

Mutation of Finalizer state

Below is the statement from documentation: The Finalizer framework uses the state of the Finalizer object, if one is attached, at the end of Queueable execution. Mutation of the Finalizer state, ...
Rajendra Singh Nagar's user avatar
0 votes
0 answers
675 views

Batch class finish method not executing on REQUEST_RUNNING_TOO_LONG error

I intended to send an email to the users when the batch class fails due to any reason. I had placed my logic in the finish method. However, my batch class is failing for the reason : [...
Shobhit Saxena's user avatar
0 votes
1 answer
268 views

How do I use batch apex if my method is creating over 40000 records

It's just a simple question I'm having(It might sound silly but I've no idea how do I insert 40000 records). I'm first creating 200 Accounts and also creating 200 child Opportunities for each Account. ...
whoisnilu's user avatar
  • 115
0 votes
0 answers
408 views

Insufficient Privilege on id:[] accountcontactrelation create record failed

Context Account read privilege is at user level Sharing rule allows Users to see other User's Account records, Read privilege only. An LWc on a Visualforce Page allows a user to perform some business ...
BeginnerArtist's user avatar
2 votes
1 answer
819 views

How to know when the last batch job in parallel execution finishes?

I have an apex class that is executed in parallel by calling Database.executeBatch() in a loop, where each instance processes a chunk of a dataset. After all the jobs that were executed finish I need ...
TemporaryFix's user avatar
  • 2,897
3 votes
1 answer
248 views

Best architecture solution for Mixed DML Exceptions inside a Batch

I am writing an apex Batch First I am updating a few EmailTemapltes and then I need to write to a custom object. public void execute(Database.BatchableContext context, List<EmailTemplate> scope) ...
Marko's user avatar
  • 31
0 votes
0 answers
1k views

Asynchronous Flow only working on create in Debug mode

I have been working on a roll up flow to sum up a field on a custom object and then update a field on the parent object with that total. However I have used the asynchronous path and while it works ...
Aaron's user avatar
  • 3
3 votes
0 answers
1k views

How to Target Element In Modal After Opening Modal

I have a custom modal component (with slots) that can be opened and closed. In a parent component I'm using this modal component and inside the body slot of the modal I have a <lightning-input> -...
jbyrd's user avatar
  • 621
-2 votes
1 answer
106 views

AsyncApex Scenarios [closed]

I am writing a few Ques for which i have found conflicting answers on Internet. Also I have written my Answers after researching on Internet, but wasnt 100% sure, hence posting these here to clear ...
Mohit K's user avatar
  • 746
3 votes
2 answers
2k views

Why would a future method not show up in debug logs?

What are some possible reasons a future method wouldn't show up in the debug logs? @Future(Callout=true) global static void myFutureCallout(Id testId){...
Olivia's user avatar
  • 3,431
2 votes
0 answers
2k views

How to Launch Asynchronous Record Triggered Flow each time a Date Field is updated

I have a date field. I want to update the record every time this field is updated. Inside of the Record Triggered Flow I have an ISCHANGED condition and am seeing the following error when I try to ...
Matthew Metros's user avatar
1 vote
4 answers
530 views

Avoid making 2 callouts for the same record

After a record is updated, i need to perform a callout to an external system, in order to synchronize the data. For that purpose, i have created a record-triggered flow for my custom object that: ...
Giorgos Galaios's user avatar
0 votes
2 answers
745 views

Question for confirmation: Callout from Trigger using Platform Events

After a record is updated in Salesforce, i need to perform a callout to synchronize data to an External System. Ideally, i would like to do this kind of synchronously, however it doesn't seem to be ...
Giorgos Galaios's user avatar
6 votes
2 answers
1k views

DML Error on new Asynchronous Record-Triggered Flow

We've recently developed a record triggered flow that retrieves data via callout when a certain field is set, using Salesforce's new Asynchronous Record-Triggered Flow. The issue we're having is, that ...
Carl-Johan's user avatar
0 votes
0 answers
634 views

Was trying to get the Data from the API Endpoints and Insert into Salesforce Org

I am new to the Salesforce Developer and was trying to do something where I was trying to fetch the data from the API endpoints and Insert into my Object of salesforce Org. Using the Future ...
Aayush Aman's user avatar
0 votes
1 answer
184 views

Why Queueable came into the picture [duplicate]

Why Queueable came into the picture when we already had Batch Apex available to Us. I know Queueable is better than future in context of accepting non-primitive data types and for job monitoring and ...
Noob_NoVoice's user avatar
  • 2,709
0 votes
1 answer
38 views

Can't create a Contact John Doe to related Account passing ID, any suggestions?

global with sharing class JohnDoeBatch implements Database.Batchable<SObject> { //Start method global Database.QueryLocator start(Database.BatchableContext bc) { String query = '...
Giosuè Zocco's user avatar
1 vote
0 answers
171 views

Modern polling solutions [closed]

Among the several ways we have in salesforce to do polling to 3rd parties using callouts, I see important drawbacks for each of those that make taking a decision difficult. Background solutions are ...
Manuel Moya's user avatar
0 votes
0 answers
30 views

Batch Job causing an error in FSC [duplicate]

I wrote a visualforce page that launches a batch job that processes records in batches, the batch creates households, person accounts, and then financial accounts for Salesforce Financial Service ...
C.Flye's user avatar
  • 23
1 vote
1 answer
882 views

Why does Future and Queueable or any Async rollback or does not get called when an exception is occurred in Main Thread?

I was trying to test if Async opens up a new thread or is tied to the main thread and the result was very interesting. Consider this class: public with sharing class TestClassTest { public static ...
Nagendra Singh's user avatar
0 votes
1 answer
1k views

In Asynchronous using Rest Api Error: System.LimitException: Apex heap size too large: 19312398

I got the error as heap size limit too large, I'm able to send below 2MB file by using Asynchronous method but the limits is 12MB and trying to send 12MB file to external system by using Rest Api. ...
user102524's user avatar
4 votes
1 answer
281 views

How bad an idea is it to make a server side "save" call in disconnectedCallback?

This LWC lifecycle method is documented as: Use disconnectedCallback() to clean up work done in the connectedCallback(), like purging caches or removing event listeners. Not that the set of ...
Keith C's user avatar
  • 135k
1 vote
1 answer
208 views

How to process a bulk of records manually

I have a visualforce page where users upload a csv file to create person accounts. This worked fine in a small sample size, but when I try a bigger file I got a timeout issue. So I split up the code ...
C.Flye's user avatar
  • 23
0 votes
1 answer
2k views

Where does Queueable job gets Queued?

I wrote this class: public with sharing class QueueTest1 implements Queueable, Finalizer{ public QueueTest1(){ } public void execute(FinalizerContext param1) { System.debug('...
Nagendra Singh's user avatar
2 votes
1 answer
439 views

LWC enforce and validate an API method before calling another method

I'm looking to enforce a validation of sort to be implemented in LWC that consumes an external API. The validation call is suppose to check user access (an APEX based external API validation). Then ...
VarunC's user avatar
  • 5,900
15 votes
1 answer
1k views

How to archive & restore Custom Objects in Big Objects

For my app I want to build a Archive and Restore functionality. For a given Custom Object MyObject__c and a Big Object ArchivedMyObject__b those requirements need to be fulfilled: MyObject__c records ...
Robert Sösemann's user avatar
0 votes
1 answer
211 views

How Can A Batch Transaction Be Executed From A Nested Loop To Update Variables In The Outer Loop?

How can we update a variable in an outer loop from a Batch transaction in an inner loop? For example, consider a example scenario where you must track the even Apples (per Basket) inside multiple ...
John Doe's user avatar
0 votes
1 answer
94 views

Why do developers set 'this' to a variable (e.g. 'self' or 'that')?

When I inherit another developers code base I will often see something declaration like the following: I have seen this most frequently used in LWCs. But I'm not sure what the purpose is and given the ...
thinker's user avatar
  • 1,402
0 votes
1 answer
619 views

Can @future be called in constructor of a class

Trailhead Link - https://trailhead.salesforce.com/content/learn/modules/asynchronous_apex/async_apex_future_methods#:~:text=Future%20methods%20won't%20necessarily,same%20order%20they%20are%20called.&...
Pankaj Kumar's user avatar
-1 votes
1 answer
182 views

How to limit the asynchronous job running in salesforce [duplicate]

I am using Queueuable Interface in trigger like this, System.enqueueJob(new testobjectmethod(trigger.new,trigger.oldMap)) My Queueuable class: public class testobjectmethod implements Queueable,...
user avatar
1 vote
1 answer
519 views

Populating a combobox with Salesforce data

I want to create a component with one input box with type="date" and a combobox that gets populated with options after a date is selected in the first input box component. I want this to ...
adidascoder's user avatar
0 votes
1 answer
1k views

How to add delay to the spinner till the Queable job gets completed [closed]

we have a lightning button on community. when we click on it a queable class gets triggered and it will update forms status. whenever I am clicking on the button it is taking some time to update the ...
user96288's user avatar
0 votes
1 answer
438 views

Choose async or sync based on amount of data returned or trigger size?

Can anybody guide me through any framework which I can refer in order to achieve this use case?I am not able to get my head around it on how to do it efficiently. I want to process records in near ...
Isha's user avatar
  • 163
1 vote
1 answer
129 views

Is there a way to get the ids of the inserted records when using Metadata.Operations.enqueueDeployment

I was going through the documentation and I saw this example public void updateAndDeployMetadata() { // Setup custom metadata to be created in the subscriber org. Metadata.CustomMetadata ...
Arthlete's user avatar
  • 4,855
2 votes
2 answers
865 views

Queueable being called from a trigger by an Asynchronous Process

Recently we moved our logic in our trigger to be asynchronous and now the helper method that the triggers call looks something like this (specifics obfuscated since it's company code): global static ...
J. Larson's user avatar
0 votes
1 answer
2k views

pass parameters to then chain in promise

I'm using JSforce to retrieve an Account Id, once the operation is completed, I need to pass the retrieved account's Id and another Map to another function. testAsync(); function testAsync() { ...
Json's user avatar
  • 1,587
1 vote
1 answer
853 views

Asynchronous Apex and Queue

I would like to confirm the following points with regard to Asynchronous Apex and particularly to these 3 in particular - Future Methods, Batch Apex and Queueable Apex. When an async request is made, ...
user73893's user avatar
  • 305
5 votes
1 answer
2k views

LWC multiple apex calls on initialization (Best practices question)

PROBLEM: I have a LWC component which needs to gather data from different objects on initialization event (Objects are: custom object, files and metadata type). This is what I have in place working ...
Alex Cortes's user avatar
3 votes
1 answer
332 views

How to monitor not yet started jobs of a Queuable chain

I am wrapping my head around how to use Apex Queuable as a queue and not as a chain. As I understand all the code samples out there, the next job is enqueued after the work of the previous one is done....
Robert Sösemann's user avatar
0 votes
1 answer
510 views

How to achieve Asynchronous Apex with Aura Components? (NOT Callouts)

I have a working Aura Application with a requirement of showing heavy data inside of many lightning datatables based on the LoggedInUser. It works fine for majority of the users but for few, the data ...
apz's user avatar
  • 355
1 vote
2 answers
464 views

Does NetworkMember solve the problem of assigning the Network Id in Communities/Experiences?

See: Why does adding a Queueable cause an INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY error? for some background. That results in the need to set the NetworkId (there is one of these per Community) ...
Keith C's user avatar
  • 135k
0 votes
0 answers
136 views

Executing a callout at the end of a chain of methods operating in @future context

I have a callout method that is executed as the last step of a long chain of methods when a record's status get changed to "completed". Early in this sequence, we have a method that we have ...
Trevor Gill's user avatar
0 votes
2 answers
231 views

Service console waits for aura component to finish init before rendering case

I have an aura component (as managed package) in service console. the component fetches case's fields (via soql), sends them to an external server, gets a response, and displays it. everything works ...
Jonathan P's user avatar
4 votes
1 answer
5k 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 ...
Keith C's user avatar
  • 135k
0 votes
1 answer
988 views

calling apex method which does callout returns undefined in LWC while showing the correct result in apex debug logs

I have the following lwc code: import findLocalityApex from '@salesforce/apex/NACController.findLocalityApex' ... findLocality() { console.log('this.lat findLocality' + this.lat); ...
nSv23's user avatar
  • 544

1
2
3 4 5
7