Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [promises]

A Promise object represents the eventual completion (or failure) of an asynchronous operation, and its resulting value.

Filter by
Sorted by
Tagged with
1 vote
1 answer
86 views

LWC Global Uncaught Promise Error Handler

I am trying to implement a global uncaught promise error handler for a lightning web component. The goal is to reduce the catch(error) statements for promises: getDocumentTypes() { ...
29espoa's user avatar
  • 33
1 vote
0 answers
42 views

Handling Complete Error Messages in JSForce Promises for Salesforce Apex REST Calls

In a Salesforce instance we have a web service to be consumed by an external service. Considering the resource that the ws will consume, it has been designed in such a way that for each request ...
Tzinm's user avatar
  • 21
0 votes
1 answer
35 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
42 views

Request/Response using LMS in LWC

I need a setup in which Component A initiates a data request to Component B through LMS (Publish). Component B, upon subscription to the request, will execute certain logic and subsequently publish ...
Cb Shivananda's user avatar
1 vote
1 answer
334 views

add a delay between lwc and apex excecution

I am struggling in one of issue. I have a lwc page where i can upload multiple files and on button click i create filerecords in sfdc and send those files to AWS(Name and some attributes are coming ...
sfdc_to_learn's user avatar
0 votes
1 answer
208 views

How to break out of the promise chain for a subsequent method after calling an Apex method in LWC?

getInformation() calls Apex imperatively which in turn makes an external callout. Once the data is received, I want doSomething() method to run. But I don't want doSomething() to run within the ...
Akif's user avatar
  • 15
0 votes
1 answer
4k views

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'values') [duplicate]

I need to render some values in the screen based in boolean variable (isLaborOrPartsLabor), and i'm setting this one in a method inside the renderedCallback(), basically, when this one it's true i'm ...
Gustavo Fazilari's user avatar
0 votes
1 answer
160 views

Aura: calling an AuraEnabled method multiple times and waiting for it to finish

I have an AuraEnabled method which does a callout. I'd like to call this multiple times from my Aura component. How can I do this and then execute code after all of them have finished? I tried doing $...
fred's user avatar
  • 3,420
0 votes
0 answers
922 views

PromiseResolve called on non-object LWC

Hello guys I have being working on a LWC custom form that gathers information. This component has various accordion section and child components. there are sections that contains lightning comboboxes ...
TechGuy's user avatar
  • 107
4 votes
1 answer
254 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
1 vote
2 answers
2k views

Hitting error "TypeError: Cannot read properties of undefined (reading 'open')" when using open() method of the new LightningModal library

I'm trying to utilize the new LightningModal library to launch a modal from an LWC component. Running into an error that I'm having trouble resolving, and hoping someone here can help me out. There is ...
Trevor Gill's user avatar
0 votes
1 answer
915 views

Uncaught promise in LWC

Hello everybody I am getting the next error: 'Uncaught (in promise) ReferenceError: LWC component's @wire target property or method threw an error during value provisioning. Original error: [...
user avatar
0 votes
1 answer
210 views

LWC call method with then which contains apex method

Sorry if question label is frustrating. I am calling lwc method and do some actions on then and inside that lwc I there are apex method. But it gives me error on then inside "firstMethod". ...
fedove's user avatar
  • 15
0 votes
1 answer
855 views

JavaScript - Execute Actions after Window.history.back()

I have a URL Button which calls a VF Page. Due to the nature of this, when the button is clicked it loads the VF Page in the URL. I need to go back to the record page and then execute an alert. ...
some guy's user avatar
  • 141
0 votes
1 answer
4k views

this.template.querySelector(...).handleUpdateCase().then is not a function

Hello, I develop a parent LWC which calls a method from a child LWC. Unfortunately, I get this error message: this.template.querySelector(...).handleUpdateCase().then is not a function This is the ...
Oupat's user avatar
  • 733
4 votes
0 answers
535 views

How run logic after NavigationMixin.Navigate completes

This code works great. this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: this.selectedObject, ...
Tom Ansley's user avatar
1 vote
1 answer
4k views

Array keep empty after push object from forEach

I am calling one helper method from another helper method using Promise to wait for the result. I have problem where JsonArray array is empty after pushing object from forEach. Did I miss something? ...
satishW's user avatar
  • 13
3 votes
3 answers
2k 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
  • 502
1 vote
1 answer
656 views

errorCallback not catching exception in child when thrown in apex call promise

I have a web component (lwc) with a child component that makes an imperative server call. When an exception is thrown by the server the parent component is not catching it in the errorCallback. The ...
Daniel Collier's user avatar
0 votes
0 answers
228 views

Add Parameter to Aura Components Apex Controller

I am relatively new to aura components and am having trouble understanding the interconnectivity between files when using parameters in functions. I added the "enrollmentId" parameter along ...
Austin Kelly's user avatar
0 votes
1 answer
6k views

CPQ Calculator - asynchronous function returning promise pending instead of a value

In the below code I am making a Server Call using a async/await. Once I get the results I want to process the results and then move along after the .Then statement. The problem seems to be that ...
CodeMonger's user avatar
0 votes
2 answers
505 views

Issue with returning a URL from wire method in LWC

In the below method, the getApprovalOrders returns the appURL which then calls this.handleLoad(obj.Id); to get the approval request Id to return the URL ${baseURL}/detail/${this.approvalId}. The issue ...
Krishnamurthy's user avatar
0 votes
1 answer
480 views

Conditional displaying error message in Lightning Accordion

I would like to display an error message regarding on JS promise. My code is this: HTML: <template for:each={test} for:item="test"> <lightning-...
CPS's user avatar
  • 345
1 vote
1 answer
1k views

Using Wire in a Child Lightning Web Component

I'm trying to build a TabSet form where each child component is a different form. I would like to use @wire in the child components to grab the object needed for the form. However, I can only get it ...
thinker's user avatar
  • 1,440
0 votes
1 answer
4k views

How to wait for a chain of wire adapters to settle before running some logic?

I'm trying to get the timing of some setup code in an LWC to be reliable. The code needs the opportunity record type Id so it can get the correct picklist values. Then with those picklist values (and ...
Keith C's user avatar
  • 136k
0 votes
1 answer
538 views

LWC When user clicks a checkbox, wait for further clicks before updating the Database - what is the best way to implement?

I'm trying to enhance this already-working component, by replacing the Save button with Auto-save feature. I've simply moved onclick={saveCheckboxState()} from Save button to all lightning-input ...
Ryan McNeely's user avatar
2 votes
2 answers
1k views

Calling two methods in renderedCallback()

In such a situation, is it possible that the result from method2 will be earlier than from method1? renderedCallback() { method1() .then(result => { // ...
Salesforce Guest's user avatar
0 votes
0 answers
463 views

Aura component: Mutiple $A.enqueueAction takes long time

I'm testing a component where I upload a file, convert to base64 and split into several CHUNK Parts send each one to an apex method. This component seems quite common online. Like: https://sfdcmonkey....
Pedro Caetano's user avatar
9 votes
1 answer
788 views

Handle chain of long-running callouts from Salesforce

I have seen Apex Promises, Apex libraries to chain Queueables, read about Continuations but I am still unsure what is the best solution for: run multiple long-running callouts Sequentially (wait for ...
Robert Sösemann's user avatar
0 votes
0 answers
487 views

lightning spinner not working

I'm using a spinner to indicate there is something loading. I added this in the template: <div if:true={pendingAction}> <lightning-spinner alternative-text="Loading"></...
joacoiudica's user avatar
0 votes
1 answer
5k views

JS Promise in LWC returning in catch block despite success response from Server side Apex

handleAddRows(event) { if (this.selectedSubjTemplate.length > 0) { this.isLoadingModal = true; createRecord({ quoteId: this.quoteRec, subjTemplates: this....
VChandra's user avatar
0 votes
1 answer
310 views

LWC import method giving error

I have AuraEnabled method in a following class: public with sharing class HistoryRecordsHandler { @AuraEnabled public static List<HistoryRecordWrapper> getAccountAndContactHistoryRecords(Id ...
mSinisa's user avatar
  • 51
0 votes
1 answer
1k 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 vote
3 answers
44k views

await does not wait for Promise to finish

In my LWC, I am trying to call an Apex method and wait for it to finish. This is what it comes down to: import apexMethodA from '@salesforce/apex/SomeControllerClass.apexMethodA'; export default ...
Sander de Jong's user avatar
0 votes
0 answers
466 views

LWC Community Navigation and api property with promise

I have a community with two pages, Page1 and Page2. Standard flow is Page1 -> Page2. When loading Page2 directly I can use it with no issues, the problem comes up when I use Page2 coming from Page1....
TEo's user avatar
  • 83
1 vote
3 answers
14k views

Error : Value provided is invalid for action parameter 'recordId' of type 'Id' in LWC imperative call to Apex

I have a simple LWC component that shows Contacts of a selected Account, i am calling the Apex method imperatively from my JS code while passing the Account recordId. Here is the Apex method signature ...
THEDJA's user avatar
  • 135
1 vote
1 answer
1k views

How to fire an application event inside a Promise - Aura Component

I am migrating some code from callback to promise, and in the original code we are firing an application event but this is causing the promise to enter in the catch part. Original Code somefunction : ...
ElkCor's user avatar
  • 317
0 votes
1 answer
2k views

Working with rereshApex async call in LWC

I am trying to work with refreshApex call in LWC to get the refreshed values for the wired data. @track records; @wire(getRecords) wiredRecords({error, data}) { if (data) { this.records = ...
Yogesh D's user avatar
  • 590
2 votes
1 answer
3k views

LWC: Issue with loading static resources

I've incorporated the code documented in the following article into a new component: Play YouTube Videos Through Lightning Web Components It seems like the two JS files referenced, iframe_api.js and ...
Michael Sobczak's user avatar
0 votes
0 answers
1k views

LWC Feature erring with `Received exception event aura:systemError from server`

I randomly began having a strange error appear that I'm having trouble debugging, all it tells me is: Received exception event aura:systemError from server What I have is a "Reports" LWC ...
BlondeSwan's user avatar
  • 1,098
1 vote
1 answer
102 views

Server Lightning calls using promises

EDIT: I could not figured out how my code is different from the link you provided and the blog, is that possible to pinpoint what/where i'm doing wrong? I'm trying to wrap my head around with promises ...
Nick's user avatar
  • 7,022
12 votes
1 answer
6k views

Chain Apex Methods in LWC

I am having a situation where I'm trying to pop an alert on an opportunity, but it's conditional based on data on the current user, and data on a custom object. I noticed that on refreshes the alert ...
thinker's user avatar
  • 1,440
8 votes
1 answer
10k 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
1k views

Using Promises not returning the resolve method in Lightning Component

I am trying to recall the apex method until I get a success response for status of log. Below is the code. checkIntegrationLog function simply check the status of a single Log and I want to call that ...
Jenil's user avatar
  • 43
2 votes
1 answer
815 views

Lightning Component - promise returned before Apex method is completed

I'm developing a component that calls an Apex method which performs a callout to our integration platform (generates an SAP customer from a salesforce account). The component is a button placed on ...
Leapin Dave's user avatar
0 votes
1 answer
2k views

Record is not getting deleted from datatable in LWC

I am trying to delete a record based on the row selection in data table in LWC. So when a row is selected, the record Id is pushed to the array selectedIdsArray but I am trying to pass it to the Apex ...
Krishnamurthy's user avatar
4 votes
1 answer
4k views

LWC - Multiple createRecord calls

I have a Lightning Datatable containing possible Opportunities. The user can select which records they wish to create Opportunities and click a button (handleContinue below) which creates new ...
Mike G.'s user avatar
  • 75
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
0 votes
1 answer
383 views

closeQuickAction does not work using javascript promises

I came across a tutorial to call Apex or SOQL using few lines of code. This code is using javascript promises in the following fashion: ApexHelperController.apxc: ({ apex: function(cmp, method, ...
Cuban coffee's user avatar
  • 1,574
1 vote
1 answer
987 views

Using LWC and an Imperative APEX method, I cannot reference the parameter being passed into APEX because it is a promise [duplicate]

I have an apex method which receives a country name and returns a country code. @AuraEnabled (cacheable = true) public static String getCountryCode(String searchString) { //TODO add the code to ...
ahsfdc's user avatar
  • 11