Skip to main content
The 2024 Developer Survey results are live! See the results

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

How to update when Lead is updated, insert related Individual(lookup standard), then update Lead with related Lookup individual on lead

I have a after update trigger on lead, so when the triggering fields like Name,Birthday are updated, the trigger fires and inserts related individual record where there is a lookup from Individual to ...
Janardhan Kumar's user avatar
1 vote
0 answers
29 views

Request.getCurrent().getRequestId() returns the same id if called inside a queueable chain

So if a have a chain of queueables that send outbound messages I grab the requestId using Request.getCurrent().getRequestId() and send it with the request for uniqueness it returns the same request ID ...
KarlLivesey's user avatar
0 votes
0 answers
78 views

Beforeunload unexpected behavior in LWC

Im trying to publish a platform event from a LWC if the browser tab gets closed or the browser itself gets closed. It works fine for both of the cases, however if I repeteadly click on the refresh ...
RProgrammer's user avatar
0 votes
1 answer
48 views

Asynchronous Path $record value is current values or previously committed values?

As it says in the title couldn't see any info on this definitively specifying which way it works or maybe I am blind? but when an asynchronous path runs on a flow is the record values in the $record ...
KarlLivesey's user avatar
1 vote
0 answers
67 views

Unexplained pause in Apex transaction

Inside a future method we are inserting some records and we've come across a problem when Apex takes about 4.5 seconds delay between 'Executes all before triggers' and 'Runs most system validation ...
Anton Solomin's user avatar
0 votes
1 answer
227 views

How can I call the PokeAPI to get all the Pokémon at once?

I'm doing a practice assignment and was asked to use the Pokémon API to query and insert all of them at once. How can I achieve that? Should I use a Batch, a future method? The service only sends one ...
PanRancio's user avatar
1 vote
2 answers
376 views

Platform Events a nightmare - How to make them work in real life

I am trying to build a Platform Event-based application logger where arbitrary application code calls Tracker.log(...); and this is sent as an Event into an external database via an API. As it's ...
Robert Sösemann's user avatar
1 vote
2 answers
62 views

I want to write a unit test that can assert an enqueued job called a specific @Future function

To start, let's say I have this simple unit test: @isTest public static void shouldCallFutureMethod() { Test.startTest(); System.enqueueJob(myQueueableJob); Test.stopTest(); } Given ...
J. Dufresne's user avatar
-2 votes
1 answer
50 views

Advantages of Scheduling through Apex than compared to the UI [closed]

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 ...
Rahul Allada's user avatar
0 votes
1 answer
45 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 ...
James's user avatar
  • 37
3 votes
2 answers
348 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 ...
Semmel's user avatar
  • 2,517
0 votes
0 answers
30 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 ...
Yan Imensar's user avatar
0 votes
1 answer
51 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 ...
batuayyildiz's user avatar
0 votes
1 answer
60 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 ...
batuayyildiz's user avatar
-3 votes
1 answer
77 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....
Amir Bouzid's user avatar
1 vote
3 answers
1k 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....
Uday Chandel's user avatar
-2 votes
1 answer
754 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 ...
Kato's user avatar
  • 1
0 votes
1 answer
83 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 ...
Dash Foster's user avatar
0 votes
0 answers
437 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 ...
Oupat's user avatar
  • 739
0 votes
1 answer
235 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 ...
Sarvesh's user avatar
  • 998
1 vote
2 answers
571 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 ...
Emmanuel_M's user avatar
6 votes
2 answers
4k 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 ...
joacoiudica's user avatar
1 vote
1 answer
295 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,...
hsd's user avatar
  • 123
0 votes
0 answers
173 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 ...
Luke Sharon's user avatar
-1 votes
1 answer
398 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 ...
Pam's user avatar
  • 107
0 votes
1 answer
126 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 ...
Pam's user avatar
  • 107
0 votes
2 answers
498 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 ...
Pam's user avatar
  • 107
0 votes
0 answers
621 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 ...
Sai Praveen's user avatar
0 votes
1 answer
150 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 ...
Paritosh's user avatar
0 votes
0 answers
883 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 ...
Emmanuel BRUNO's user avatar
0 votes
0 answers
154 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-...
Arne's user avatar
  • 101
0 votes
1 answer
238 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 ...
charlottesville's user avatar
-1 votes
1 answer
354 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 ...
Capt Shaunz's user avatar
0 votes
1 answer
896 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 ...
Praveen's user avatar
2 votes
0 answers
93 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 ...
Jose's user avatar
  • 2,142
4 votes
2 answers
2k 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 ...
Keith C's user avatar
  • 137k
5 votes
1 answer
275 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, ...
Ron Van Aken's user avatar
2 votes
0 answers
478 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 ...
Moonpie's user avatar
  • 2,714
-2 votes
1 answer
160 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 ...
Dev098's user avatar
  • 1
1 vote
1 answer
853 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}" ...
erikvm's user avatar
  • 711
0 votes
1 answer
937 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 ...
Shanerk's user avatar
  • 1,075
0 votes
0 answers
379 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 ...
LucyFenel's user avatar
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 ...
Leonardo dos Santos Zamboni's user avatar
0 votes
1 answer
837 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 ...
kkJhn's user avatar
  • 23
2 votes
1 answer
2k 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 ...
d-fws's user avatar
  • 25
4 votes
1 answer
293 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 ...
Nagendra Singh's user avatar
0 votes
2 answers
2k 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. ...
threeone97's user avatar
0 votes
1 answer
468 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 ...
IHaveAQuestion's user avatar
2 votes
2 answers
3k 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 ...
Mariia Illarionova's user avatar
0 votes
1 answer
559 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 ...
sfdeveloper's user avatar

1
2 3 4 5
7