function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
naveen reddy 19naveen reddy 19 

How to chain server calls synchronously in lightning web components

Hi All,

I have requirement where user have to process multiple records each at a time due to governor limitations.

For the incoming multiple records each record is taken and calls apex. After the successful response have to place the same request again. Like so to process all records.

Can someone help me how to achieve this. 
import { LightningElement, api, wire, track } from 'lwc';
import createRecord from '@salesforce/apex/OpportunityLoadController.createRecord';

export default class OpportunityLoadLWC extends LightningElement {  
@api error;
@api resultLst = [];
@api message; 
//Other logic
handleClick(e) {
        var oneRecord = resultLst.pop();
           data : oneRecord
        .then((result) => {
            //call createRecord again
        .catch((error) => {
            this.message = 'Error received: code' + error.errorCode + ', ' +
                'message ' + error.body.message;


Thanks in advance.

Naveen Mallepalli.