1

I have a visualforce page where users upload a csv file to create person accounts. This worked fine in a small sample size, but when I try a bigger file I got a timeout issue. So I split up the code to process things in future callouts. Now I get this error, FinServ:Too many queueable jobs added to the queue: 2, which I have come to the conclusion that this is coming from FSC and it only occurs on every callout after the second future callout.

I have come to the conclusion that I should process the records x amount of time after each time the user clicks next. For example there is a total of 10,000 total to upsert from the csv file as lines. I read in the whole file 2,000 lines at a time for each time the user clicks next and let them know what was upserted. How would one accomplish something like this? can it even be done?

1 Answer 1

2

I would do this on the client-side for performance reasons. You can use something like papaparse to read the CSV in JavaScript, then use apex:remoteObjects to upload them in batches of 200 (or whatever), or even use a @RemoteAction method if you really like writing Apex for no good reason¹. Using a technique like this, handling tens of thousands of records is trivial, they are not considered asynchronous calls (so no need to worry about asynchronous limits like number of Queueables added), and is as fast as your org is optimized.

¹I love writing Apex, but when there's a better/easier tool for the job, I'd rather use that instead.

1
  • Wow thanks! I have a lot of apex already written so I think I will make use of the @RemoteAction functionality and convert things over.
    – C.Flye
    Commented Aug 9, 2021 at 20:56

You must log in to answer this question.

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