Merge Documents from Salesforce Reports

In the WebMerge Managed Package (versions 1.238+), we have a built-in Visualforce page that will allow a user to populate documents with data from Salesforce Reports. To activate this page, we suggest you create a new Tab:

  1. Under Setup > Create > Tabs, create a New Tab.
  2. For the page, select WebMergeReport
  3. Enter a name for your Tab and save.

 

new_tab.png

 

 

 Once you have setup your Tab and activated it for your users, it will be available to merge.  Simply click on the new tab, then you'll see a page like this where you need to pick the report and the document/data route you want to merge:

merge_page.png

 

When the data is sent over to WebMerge, each row in the report will be sent over using "_rows" as the name of the merge field. You can then loop through the data in your document like you would a Child Relationship: https://support.webmerge.me/hc/en-us/articles/206527196-Working-with-Child-Relationships

For example, to loop through all the data in your document, you can do something like this:

Opportunity Status Amount
{tablerow from=$_rows item=_row}{$_row.NAME} {$_row.STATUS} {$_row.AMOUNT|number_format:2}

We also suggest using Debug Mode to see the field names coming over from the report.

 

Create Individual Documents

If you would like to merge individual documents for each row in your report, there's an option under Additional Options. You can also check the box to combine all the documents into a single file and the file(s) will be delivered via the delivery option you have setup for that document.

In your template, you'll use your report columns as merge fields like {$NAME}, {$ADDRESS}, etc

Have more questions? Submit a request

20 Comments

  • Avatar
    Moira Chadwick

    Hi Jeremy. Does this work in Lightning? (your graphic appears to be SF Classic).

  • Avatar
    Jeremy Clarke

    Hi Moira,

    Yes, it should work in Lightning too :)

  • Avatar
    Mendy Ezagui

    Hey Jeremy, can't find this VisualForce page in my org.
    Checked Setup > Custom Code > Visualforce Pages.

  • Avatar
    Jeremy Clarke

    Hi Mendy,

    Please make sure you're using the most recent version of our managed package.

    Thanks!

  • Avatar
    Mendy Ezagui

    Correct, as always. Thanks for your help.

  • Avatar
    Kevin Mulligan

    I can create and deliver a merge doc with child records from a button on the parent record.
    How do we run/setup a report to merge multiple records with child records? For example 5 different Opportunities (from 5 different Accounts) with 3 different Opp Products on each record?
    The end goal is to email 5 merge docs (with the Opp Products) to 5 account. Do we need to set as 'Summary Report' and group by the Opp? If it is tabular report (not grouped) and /or I set it to run on each row, then it would merge to 15 docs (5 Opps x 3 Opp Products).
    Thanks, Kevin

  • Avatar
    Kevin Mulligan

    Also my data is not populating the report. It may be due to:
    "In your template, you'll use your report columns as merge fields like {$NAME}, {$ADDRESS}, etc"
    Does that mean we need a new template specifically for reports and we do not need to setup mappings? IE if a report column is Item_Amount we just need a merge field called {$Item_Amount} and it will pull in?
    Thanks

  • Avatar
    Mendy Ezagui

    +1 for Kevin's questions. This is not clear.

  • Avatar
    Jeremy Clarke

    Hi Kevin,

    For your first question, I would suggest merging those 5 documents from a List View like this: https://support.webmerge.me/hc/en-us/articles/215114403-Generate-Documents-from-List-View

    Merging documents from Reports will create a document for each row in the report (or a single doc with all rows).

    If you are generating a document for each row in the report, then yes, you'll just use the column name as the merge field {$ITEM_AMOUNT}. You can turn on Debug Mode (https://support.webmerge.me/hc/en-us/articles/206526126-Debug-Mode) and run a test to see exactly what the field names are called.

    Thanks!

  • Avatar
    Mendy Ezagui

    Jeremy, us Lightning folks can't use the JS option. Salesforce is nearly all Lightning.

  • Avatar
    Jeremy Clarke

    Mendy,

    You don't need JS :) Please re-read that article. We've recently built a way for you to do it directly from a List View without a JS button (using a VF page instead).

    Thanks!

  • Avatar
    Jenn Bowers

    Do I understand that the tags for generating documents through reports are different then normal? It looks like your using SF api fields?

  • Avatar
    Jenn Bowers

    Do I understand that the tags for generating documents through reports are different then normal? If so, what would a name field look like if pulled through a Case report?

  • Avatar
    Jeremy Clarke

    Hi Jenn,

    Yes, when pulling data from the Reports, we use the names from the report. The easiest thing to do is turn on Debug Mode (https://support.webmerge.me/hc/en-us/articles/206526126-Debug-Mode) and run a test merge then you can see all the data (and the field names) that are being sent over from the Report.

    Thanks!

  • Avatar
    Jenn Bowers

    I have just installed Webmerge in my lightning org and I'm trying to create the to merge from SF Reports. There is no field in any of the new tabs for the visual force page. and the object WebMerge Report is not available for selection. Can you please advise if this ability is still supported?

  • Avatar
    Jeremy Clarke

    Hi Jenn,

    Yes, this option is still available. Are you sure you're creating a New Visualforce Tab and not a New Object Tab?

  • Avatar
    Jenn Bowers

    Got it Jeremy, We can generate the merges in bulk from a list view, but how do we merge that list into a single document and retrieve it? Can this be downloaded as one document?

  • Avatar
    Jeremy Clarke

    Hi Jenn,

    In this help article (https://support.webmerge.me/hc/en-us/articles/215114403-Generate-Documents-from-List-View) it describes how to setup the VF page for the List View merge. In that VF Page code, there's an option for "combine" and you need to set that to "true"

  • Avatar
    Kris Ryan

    How do you pass an ID to the report?

  • Avatar
    Jeremy Clarke

    Hi Kris,

    What kind of of ID are you trying to pass? The functionality will automatically send all data that's listed in your report (in the table)

Please sign in to leave a comment.
Powered by Zendesk