Merge Documents from Salesforce Reports

In the Formstack Documents 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 > Tabs, create a New Visualforce 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

Was this article helpful?
0 out of 0 found this helpful

Comments

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

    0
  • Hi Moira,

    Yes, it should work in Lightning too :)

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

    0
  • Hi Mendy,

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

    Thanks!

    0
  • Correct, as always. Thanks for your help.

    0
  • 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

    0
  • 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

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

    0
  • 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!

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

    0
  • 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!

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

    0
  • 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?

    0
  • 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!

    0
  • 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?

    0
  • Hi Jenn,

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

    0
  • 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?

    0
  • 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"

    0
  • How do you pass an ID to the report?

    0
  • 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)

    0
  • I have a few questions about this, it is finding some data in my report but filling the rest of the field with "f", any idea why? Also, Can you do a combination of regular merge mapping fields and embedded report?

    0
  • Hello Lynn,

    You can merge from multiple objects within Salesforce. You may have to use more than one method inside of Salesforce. I have created a ticket from your question because there could be an issue with the formatting inside of the template.

    We will be in touch soon!
    Thank you,
    Christina

    0

Please sign in to leave a comment.