2

The Extended Mail Merge feature allows Admins to create a Mail Merge template with numerous fields, which users can use to export data in PDF format when they go on the "Activity History" section on the related object (example: Oppty) and click the "Mail Merge" button.

Unfortunately I get only main object fields exported (Oppty name, Oppty amount etc) but not related records (tasks or events).

Is there another possibility for this ?

0

You can create a page layout using a custom controller or do a "mash up" to combine just about anything you want and also have it do pagination for you. Once you have it working, just add renderAs="pdf" to the VF <apex:page controller="mycustomcontroller"> statement at the top of your page like below:

<apex:page controller="mycustomcontroller" renderAs="pdf">

All the pages will then render as PDFs that you can save to a file. What immediately comes to mind would be similar to the kind of controller that one would create for doing custom quotes, but there are obviously many different ways of doing this. It really depends on what you're looking for and how you want the information formatted.

In the scenario I just described, you'd use repeats for each field in an Opportunity and additional sub-repeats for related Activity fields that would appear for each Opp.Id since there could potentially be many related activities for each Opp Id. They'd get passed to the page in what amounts to a wrapper class that you'd need to create in the controller.

That's easy to do on a per/Opp Id basis but would be more complex when you start doing it in a list view situation where you have many Opp Ids to process. I'm not certain whether you'd run into issues with your view state or not. You might need to clear it on occasion to help avoid those kinds of issues because of the size of your query that you'd potentially be holding in your controller unless you were doing a query more as needed. I've never encountered a situation where I've done a custom quote controller involving more than one Opp ID at a time, so can't say if this would actually be necessary. But then, I also don't know how many records, or pages of records, you're looking at processing at a time.

In any case, I hope that helps give you some ideas from which to start from. I don't know of any other way to "batch print" this type of thing from SF, which technically sounds like the essence of what you want to do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.