Quantcast
Channel: Imperative Call Using Await In LWC - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by Sneh for Imperative Call Using Await In LWC

$
0
0

You can call another async method from the wired function by passing required parameters.

@wire(getRecord, { recordId: '$recordId', fields: RECORD_FIELDS })wiredRecord({ error, data }) {    if (error) {        console.log(error);    } else if (data) {        this.processResponse(data.fields.Id.value)    }}async processResponse(recordId){    try {        const moreData = await fetchMoreData({ recordId });        //doStuff();    } catch (error) {        console.log(error);    }}

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>