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
1 answer
30 views

Chaining Queueable Apex with Callouts Run Into Loop

I have a queueable class that is triggered from a trigger that makes a callout. I wanted to use Queueable for scenarios where I need to insert 3-5k of records and eventually make 3-5k callouts. But ...
  • 5
0 votes
0 answers
34 views

Testing asynchronous flow in Apex test method

I am somewhat vexed by this and I would like a little guidance. I have a flow that fires on record create or update and I have written an Apex test class to test that it works as intended. I have set ...
  • 3
4 votes
1 answer
105 views

CDC processes all 9999 requests at once. Is this by design or a bug?

In salesforce documentation batch size of platform event is mentioned as 2000 maximum (documentation). Which it definitely follows (tested). But for CDC its not mentioned. I also tried this in my dev ...
0 votes
1 answer
66 views

Faster way for deleting millions of records

We have to delete nearly a million record on a daily basis. We currently have a batch which is scheduled and it deletes all the records. The batch is taking too much of time to delete these records. ...
0 votes
1 answer
35 views

UpdateAsync(sobject) Method to update records in a (spawn) new transaction

The documentation says that data on the external system. Asynchronous operation is used to process\update these records Query Does this mean I can update Sobjects (custom and\or standard) using this ...
1 vote
1 answer
35 views

WebService returned a SOAP Fault: INVALID_SESSION_ID: This session is not valid for use with the API (async job)

I've take a look at a bunch of similar questions on stackexcahnge, but they weren't helpful. Here is the short explanation of the problem: We have a managed package with MetadataService class On one ...
0 votes
1 answer
34 views

Can multiple async methods updating same record can create row lock issue

Does multiple asynchronous process like Queueable, future etc running concurrently that are updating same record create row lock issues. We are facing row lock issues in async transactions that ...
0 votes
1 answer
69 views

AsyncApexJob returning two records for one executed instance of batch

When I am executing one batch then that batch runs only once. I have verified it from the 'Apex Jobs' from Setup. But when I am querying the AsyncApexJob for that batch class, it is returning two ...
1 vote
1 answer
60 views

LWC Async Function Returning Early

This may be an obvious question. It seems like it should be, but I haven't used async/await before. I have the below code removeProduct(event) { let removeProduct = this.checkRemoveProduct(); ...
  • 23
0 votes
0 answers
50 views

Time-based Workflow Schedule Date keeps getting pushed forward 5 minutes

I created a record triggered after update flow that tests if a field has changed in the entry criteria, allowing me to create an async path: When a record is updated, the immediate path executes, ...
-2 votes
1 answer
90 views

How to make a batch class synchronous? [closed]

How to make a batch class run synchronously?
0 votes
0 answers
55 views

Retrieve the index of item in list before insertion within Stateful Batch Apex Class

I have a batch class that implements the following headers Database.Batchable<Map<String, Object>>, Database.Stateful . Within the DocumentParser class, I am creating a Map Object that is ...
1 vote
0 answers
80 views

Governor Limits: Scheduled Flows vs Async Apex

tl;dr - Do schedule flows (flow builder, not process builder) count against the same limit of scheduleable jobs that asynch apex (Queueable, Scheduleable, Batch) is limited by? If not, in what way to ...
  • 640
0 votes
1 answer
226 views

Expand all rows of LWC tree-grid with asynchronous loading

I'm having trouble figuring out how to create a button to expand all rows with my current setup. The child rows are only loaded when the parent is toggled. Is there a way to retrieve them all at once ...
0 votes
1 answer
85 views

Batch Apex: class executed multiple times at once?

I have a batch apex class, and this class makes a SELECT with a limit of 1000. after that, this class creates one campaign using insert, and processes others things, whatever. the question is when I ...
0 votes
0 answers
16 views

Most elegant/efficient way to associate Closed Won Opportunities with Open Opportunities via a junction object, based on 2 criteria

Most elegant solution This is for an interview, which has past. It bugs me I don't know the answer, so I'm seeking to know best practices, most efficient way from you all. Perhaps it's as simple as ...
0 votes
1 answer
72 views

INVALID_ACCESS_LEVEL you don't have access to the Orchestration Run object

I have a flow that cancels an Orchestration, it works when run as an administrative user. When I run as a non administrative user, it produces the following error even when the flow is set in system ...
0 votes
1 answer
429 views

Future Callout and Invocable Apex

I have an invocable apex method that calls to a future (callout=true) method. The callout returns a response that needs to be returned to the front end. I am stuck because I can't return a value from ...
  • 3,245
1 vote
0 answers
45 views

Is it possible to create user and assign permission set in same flow?

I am trying to create users and trying to assign permission sets to them using flow. Since we get MIXED DML error when we try to do both of these tasks in a single transaction, I tried to use the ...
0 votes
2 answers
42 views

Best practice for async apex classes (Queueable, Batchable) in relation to service classes

When creating async apex classes (e.g. Batcheable, Queueable), especially classes associated with specific SObjects, what might be the best practice for where these async classes should be housed. ...
  • 640
0 votes
0 answers
82 views

Record triggered asynchronous flow vs Maximum number of methods with the future annotation

I have a scenario related to a potential issue we are facing in an org. An autolaunched flow executes once and loops 51 times through a create record element which creates 1 single record in each ...
  • 1
0 votes
1 answer
298 views

Metadata cannot be deployed from within a test [duplicate]

When trying to insert a custom metadata record within the test it gives me the following error @IsTest public class Object_1TriggerTest { @IsTest public static void Load_field_1_from_metadata()...
0 votes
1 answer
325 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 ...
  • 45
1 vote
0 answers
66 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 ...
2 votes
3 answers
490 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 ...
  • 392
0 votes
0 answers
9 views

How to test asynchronous flow? [duplicate]

I have an asynchronous flow that updates a parent record when a child is created. It's async because I reference a roll up sum field on the parent in the flow. This works fine. I'm writing an apex ...
  • 616
0 votes
1 answer
47 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(...
  • 45
2 votes
2 answers
631 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 ...
2 votes
2 answers
132 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, ...
0 votes
0 answers
233 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 : [...
0 votes
1 answer
71 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. ...
0 votes
0 answers
182 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 ...
2 votes
1 answer
319 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 ...
  • 2,667
3 votes
1 answer
65 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) ...
  • 31
0 votes
0 answers
440 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 ...
  • 1
3 votes
0 answers
334 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> -...
  • 531
-2 votes
1 answer
69 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 ...
  • 750
3 votes
2 answers
564 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){...
  • 3,245
0 votes
0 answers
788 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 ...
0 votes
0 answers
66 views

Leaflet map loaded multiple time - Async function

I am using a leaflet map in a LWC. For some reason that I am not understanding yet my map is initialised multiple time (3 times to be exact) and then I am getting errors such as I am doing something ...
  • 325
1 vote
4 answers
251 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: ...
0 votes
2 answers
276 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 ...
0 votes
0 answers
81 views

Phantom Runaway Queuable Job "Limit Check"

I have some very strange sandbox behavior - there is a runaway queuable job that appears to be doing absolutely nothing in the system, last only .006 seconds, and completely locks up the system as it ...
  • 800
6 votes
2 answers
713 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 ...
0 votes
0 answers
259 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 ...
0 votes
1 answer
103 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 ...
  • 2,679
0 votes
1 answer
32 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 = '...
1 vote
0 answers
82 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 ...
0 votes
0 answers
29 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 ...
  • 13
1 vote
1 answer
377 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 ...

1
2 3 4 5 6