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
Danny LeungDanny Leung 

Generating multiple statements

I am building a financial service application using native Force.com.  The application will serve more than 1000 customers and it has to generate monthly statements for the customers.  I plan to use VisualForce page to build the monthly statement as a PDF page, one for each customer.  For the sake of operation efficiency, I have to build a process which allows user to generate the monthly statements for the 1000+ customers in a single request instead of opening the VisualForce PDF page one by one manually.

 

In summary, the process I need to build should allow user to:

  1. Generate the monthly statements for 1000+ customers in a single request.
  2. Export the generated monthly statements to user’s desktop computer for subsequent printing.

 

Could anyone help to advise how can I achieve it using Force.com?

 

Thanks and best regards

Danny Leung

WizradWizrad

I am trying to do something similar and my experience thus far is as follows:

 

1) Apex has limits on the number of statements you can execute, and on the amount of time 1 transaction can take.  Generating 1000 PDFs is not going to happen in under that time limit.

 

2) You would think Batch Apex would be the solution, but you can't use getContent() within Batch Apex.

 

Perhaps you could write some APEX that runs nightly and saves as many of the PDFs as possible to Documents, and when it comes time to get all 1000 PDFs at once with one button click at least it wont have to try to generate those 1000 on demand.  Or you could call a webservice to perform this functionality.  

Danny LeungDanny Leung

I have also thought about using nightly run.  However, as you mentioned that Batch Apex does not allow getContent(), how could we save the PDFs to Documents?

 

dmchengdmcheng

Have you considered a 3rd party solution?  Conga MailMerge and Conga Composer are excellent products.  I've used them over the past couple years.

Danny LeungDanny Leung

Thanks for your advice.  I will look into these products.