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
36 views

Advantages of Scheduling through Apex than compared to the UI

I'm exploring the options for scheduling tasks within Salesforce, and I'm particularly interested in understanding the benefits of utilizing Apex for scheduling compared to using the built-in UI ...
0 votes
1 answer
37 views

How to get these two functions in LWC to not run at the same time? How to get one to wait for the other to be finished?

connectedCallback(){ this.blurHandler = () => this.testFunction(); this.beforeUnloadHandler = () => this.testFunction(); } I am getting the issue where both of these events the blur and ...
6 votes
2 answers
2k views

Best approach to make callouts from trigger

I have a requirement in which, for each time an account is inserted, I have to make a callout to an external system sending some data of the record and then the API returns a unique Id that I have to ...
0 votes
0 answers
26 views

Does anyone have experience with the using the docusign genAndSendEnvelopes api endpoint to generate a gen template then send it?

We have a request to automatically generate a docusign gen template that contains merge fields from an opportunity then automatically send it. Docusign have confirmed this is not possible using the ...
3 votes
2 answers
145 views

Imperative Call Using Await In LWC

Is it possible to imperatively call a function from a wired function using async/await? And yes, I've seen similar questions - but they kinda miss the point I'm trying to make. Consider this simple ...
0 votes
0 answers
28 views

Best practice to deal with HATEOAS api callouts

I'm creating an connector between Salesforce and a ticketing system that exposes a REST API based on HATEOAS. I need to synchronize tickets everyday and insert/update them as Cases. Salesforce is ...
0 votes
1 answer
32 views

lightning-spinner does not show up when a js function is working

Here is my code // Need to use the result from Promise but it is coming false const validateCompleted = await this.validateData(data); if(validateCompleted){ ... } // When validating data, I want ...
0 votes
1 answer
44 views

Async implementation of EmpApi's Subscribe method

Need to wait the Subscribe operation to be done to get the message from Platform Event to use that message in the Apex call in LWC. You can check the code below. // Apex method call to insert metadata ...
-3 votes
1 answer
61 views

System.FinalException: SObject row does not allow errors on Batch

i am trying to create a batch that prevent from creating duplicate records. This is my classes and trigger Class batchCheckDoublonContact : global class batchCheckDoublonContact implements Database....
10 votes
3 answers
1k 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 ...
1 vote
1 answer
1k 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, ...
0 votes
1 answer
1k 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 ...
1 vote
3 answers
490 views

I am trying to schedule a basic batch class with a CRON expression which schedules it for every 5 minutes everyday

I created a basic batch class. global class MyBatchClass implements Database.Batchable<sObject> { global Database.QueryLocator start(Database.BatchableContext bc) { return Database....
-2 votes
1 answer
375 views

Which is a better approach when updating records using batch class, to place it in execute or finish method?

Sorry but I am new to this and I just wander, do you think it is better to put all the millions of records inside the Map object which is process by the execute method, however the dml where the ...
0 votes
1 answer
51 views

Issue using multiple ISNULL entry conditions for a record-triggered flow

I am running into issues when setting up an asynchronous flow to trigger based on multiple ISNULL conditions. For context, there are two separate account look up fields. When one of these fields is ...
1 vote
2 answers
512 views

Dynamic SOQL Error: Unexpected Token ':' - I have searched for two days, what could I be missing?

I have a batch class that will be performing some actions over selected Case records. The only problem with this batch class is the Start method. When the query is returned and processed, it returns ...
2 votes
2 answers
2k 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
0 answers
139 views

Asynchronously flow doesn't run

Hello, I am working on a flow when an user is deactivated, I have to update some accounts depending criterias. Because I update related records and because I update accounts after an user, I use a ...
1 vote
1 answer
222 views

Async/await is not working in LWC components on Firefox

We tried to use it in our LWC async/await but it is not working only on Firefox. Here is a simple example. On the Firefox this alert doesn't show. async init() { let promise = new Promise((resolve,...
0 votes
1 answer
154 views

Fix Record Lock issue or Record Not available

I have a trigger on an Object called SubscriptionProductCharges. we have another system that are updating SubscriptionProductCharges records in a batch of 1, which means if we update 5 records, then ...
0 votes
0 answers
78 views

Failing Salesforce Queue

I am rearchitecting some apex code that I have been handed. I updated an @future method to use the Queueable interface, because as it turns out the method was being called as part of trigger that was ...
-1 votes
1 answer
210 views

LWC - How to populate component when the page just load

I'm using Custom Setting to remember what user set for that specific setting. So when the component load, it will fetch values from Custom Setting. (1)If there is no value => Column will generate ...
0 votes
1 answer
96 views

LWC - Cannot fetch Currency field type to display in lightning-combobox

I'm trying to get all currency field type of a specific object and display it in lightning-combobox but it does not work. When I execute this method with anonymous window, I got the result I want. But ...
0 votes
2 answers
282 views

LWC - Async/Await but value hasn't returned

I have 2 picklists. When the first picklist get clicked, it will captured the value and pass to the second picklist. Right now, I'm using async/await and also try to call it imperative but it did not ...
0 votes
0 answers
568 views

Having issues with the flows whenever they run in Asynchronous mode

While working on establishing a record trigger flow, my objective was to synchronize and manage specific fields related to Skills and Certifications between the PSA system and the Skill object in the ...
0 votes
0 answers
15 views

When will Aysnc method or Class will execute? [duplicate]

We have a case object subject field. When the case is created, Trigger fires and update the subject, then flows fire to update subject again..Now i have a future method or Queueable class or batch ...
0 votes
0 answers
54 views

Capture few Case fields changes and send to third party

We want to track around 20-30 fields changes of case object. These fields changes can include the long text area field, multiselect picklist values, formula fields, and roll summary also. The reason I ...
0 votes
1 answer
112 views

What is meant by resources being available in context of a future method?

Future methods execute when the resources are available. How does a future method know that the resources are available and is there any time limit after which the future method halts if the resources ...
0 votes
0 answers
683 views

Can I run an asychronous flow after insert?

To create a flow that runs asynchronously I have to add a condition with ISCHANGED or configure it to run only when a record is updated to meet the condition requirements. The ISCHANGED function does ...
3 votes
2 answers
5k views

Asynchronous getContent hit org.apache.commons.httpclient.RedirectException: Maximum redirects (100) exceeded

we're having an issue with getContent() in asynchronous context, and I just can't find any way to work around it... We're exposing invocable Apex in our managed package, and one of them allow our ...
0 votes
0 answers
98 views

Idiomatic way to call external APIs from Salesforce

I'm new to Salesforce, and am looking for advice on how to best approach a scenario where a Salesforce runtime communicates with an external REST-service that is under my control. My background is web-...
2 votes
1 answer
1k 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 ...
0 votes
0 answers
239 views

System.AsyncException: Database.executeBatch: batch apex job enqueue failed

I have a batch class which updates a set of records with data from an external system. About twice a month or so, this exception is thrown: errorCode":"APEX_ERROR","message":&...
0 votes
1 answer
194 views

Empty values when trying to run part of Flow Synchronously and part of it Asynchronously

I have a Flow that runs when an Opportunity is created or updated. The Flow is supposed to update some values on the ProductLineItems that are associated with the Opportunity. Part of the Flow runs ...
-1 votes
1 answer
291 views

Pass Http Get and Http Post as asynchronous apex in order [closed]

My requirement is to pass data from my org (Salesforce) to external org (SAP S4). I have successfully made the class for integrating both. However, I need to pass this class in a trigger and since it ...
0 votes
1 answer
736 views

LWC async/await execution is stepping to next line before resolving promise

From the below code, I'm trying to get the userId for each user in the list and add it to userRec array, using await for the promise to be resolved before going to next step. I expect the logs to be ...
2 votes
0 answers
427 views

Why does an Apex Action ConnectApi call from Flow work synchronously but fail asynchronously for Platform Integration User

Background We have a dev sandbox that is connected to and receives orders from a SFCC storefront, thus creating an Order record in the SF org. There is an OOTB Create Order Summary Flow that is ...
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 ...
2 votes
0 answers
83 views

Apex Engine old Version of apex code changed?

Recently (since January) we have encountered some cases when deploying new versions of our managed package. We have had at least 2 separate instances where changing a batch or an apex class referenced ...
4 votes
2 answers
1k views

How to avoid running a batchable when an instance is already running?

We have several batchables that if run in parallel trample over each other's results. So I want to block a second invocation if there is already one running and just tell the user to wait. My first ...
2 votes
2 answers
3k 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&...
4 votes
1 answer
248 views

How do we resolve LWC timing issues with less trial-and-error?

It seems like a more comprehensive discussion of LWC async programming would be helpful. Luckily most stuff works if you follow the LWC examples, but once your design falls outside the examples, ...
1 vote
1 answer
599 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 ...
8 votes
3 answers
4k 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 ...
-2 votes
1 answer
144 views

Batch Apex Class to update lookup field

I really need help with my code. I am trying to update Account records with lookup field to right Pricebook2 based on Customer_Price_Group__c field on Account and Pricebook2. Customer_Price_Group__c ...
1 vote
1 answer
739 views

Async call on aura:method?

I got an aura:method inside my child component that returns an async response <!-- inside child component --> <aura:method name="saveMethod" action="{!c.saveChanges}" ...
-2 votes
1 answer
1k views

Is there a way I can run an asynchronous batch class synchronously? [closed]

I know, it should not be done. But theoretically is it possible?
0 votes
1 answer
737 views

Async/Await or Request/Response LWC Messaging

I have several LWC components that share data with each other. I am sending messages across just fine between the sibling components and sharing data based on events and user actions. However, I have ...
0 votes
0 answers
355 views

What can be the reason why unit tests pass in the Sandbox environment but fail during deployment to the same Sandbox?

We have a Sandbox_1 where all unit tests are running properly, and we want to deploy our code to an entirely different organization via our repository When running unit tests we have issues with ...
2 votes
1 answer
1k views

How can I make multiple Http callouts in a row?

I need to build an apex class that will perform multiple callouts in a row to an external system and upsert some records. Right now I'm sending a POST method with a query in the body and getting an ...

1
2 3 4 5
7