I am building a financial report as like below

enter image description here

Since we know we are building for the whole year or two year and since its finacial report the number rows will be heavy. Since its finaicial report we Aggregate to sum the records and as we have millions of records we are sure that number of query rows will cross the governor limit 50001 and that is the issue we are facing currently.

So the solution I saw is using only batch class as there are million of records to aggregate.

Just want to know whether we can call Batch apex from LWC component , wait for the batch apex to finish its operation then finally return back the result to LWC component for display

1 Answer 1


I would suggest you get your data in chunks. You can write the logic in the LWC js file. And once all data is received, you can do calculations in js only.

I don't think that batch will help you in this case.

  • Any Idea how to split to chunks in LWC?
    – SFDC buddy
    Commented Nov 17, 2022 at 7:14
  • To do this you need to create a promise in the js file and need to do imperative apex calls in the loop. And, add data in js variable as it is returned from the apex. Commented Nov 17, 2022 at 8:34
  • For iterating over the loop you should know the size of the data, so you can terminate the loop. Commented Nov 17, 2022 at 8:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .