Merge Salesforce reports into a template

Merge Salesforce reports into your templates using a DocGen Package. You create a Salesforce report, then associate that report with a template in the DocGen Package. Nintex Drawloop DocGen® for Salesforce will take the data from the report and add it to the output document, using the tags you specify in the template.

Merge Salesforce Reports to Microsoft Word templates

You can merge Salesforce reports with Microsoft Word templates.

To merge Salesforce reports to Microsoft Word templates

Tip: You must have a Salesforce report to complete the procedures in this topic. This report must be shared to a folder, so that you can access the report from within the app. For more information, see Reports.

  1. From the Force.com app menu, select Nintex DocGen, and then click DocGen Packages.

    Tip: You can also select this from Lightning with the App Launcher.

  2. Open the DocGen Package that you will use to merge a Salesforce report.

  3. In Select Files of the DocGen Package, add a Microsoft Word document to serve as a template, then select the document from the middle grid. For more information on adding files, see Adding template files to DocGen Packages.

  4. Select Salesforce Reports from the drop-down list, select the folder for your Salesforce report, and then select the report you want to merge with the Microsoft Word template you added in step 2.

  5. With your Microsoft Word template highlighted, drag your report to the far-right grid.

    Tip: In Lightning, you have to click the play button each time you access the Select Files user interface.

  6. In Sheet/Range, type a value to assign a range name to your report. This range name will be used to tag your Microsoft Word template. For example, you can type AnyRange into Sheet/Range and the app will use AnyRange as the basis for all tags associated with this data merge in the template.

  7. Open the Microsoft Word document, insert a table for row replication, and add tags that will utilize the range name. For more information, see Tagging a Microsoft Word document and Row replication in Microsoft Word.

  8. Chose one of two methods for tagging your Microsoft Word template using a range name.

    • The first method simply utilized the range AnyRange_Start surrounded by angle brackets. This method will simply dump the Salesforce Report into your table as it appears within Salesforce. So, in order to get all necessary information, your Microsoft Word table must contain the same number of columns that exist in your Salesforce report.

    • The second method utilizes the range AnyRange_Start tag with column ranges tags. These column range tags merge specific columns of your Salesforce report into specific columns of your table. The syntax for using column ranges is Range Name with col appended to the end in addition to the Salesforce report column number. For example, AnyRange_Startcol1 is equal to column 1 from the Salesforce report and AnyRange_Startcol2 is equal to column 2 from the Salesforce report. Using column ranges allows you to have fewer columns in your Microsoft Word table than there are in your Salesforce report. In our example we will be merging columns 3, 2, 4 and 1 from our Salesforce reports into columns 1, 2, 3 and 4 from our Microsoft Word table respectively.

  9. Once you tag your Microsoft Word document, you must upload and replace the document in Salesforce with the one you tagged.

  10. Generate the documents for this DocGen Package by selecting Generate Documents on a record from the starting object for the DocGen Package.

Use Salesforce Report Filters with DocGen Packages

You can add filters to Salesforce reports and manage these filters in the DocGen Package. You add a filter to a Salesforce report, then enable the filter in the DocGen Package.

You can use both static and dynamic filters, but the process for each is a little different.

To add a static filter to a DocGen Package

  1. In Salesforce, add a static filter to a Salesforce report.

  2. In Select Files of the DocGen Package, add a Microsoft Word document to serve as a template, then select the document from the middle grid. For more information on adding files, see Adding template files to DocGen Packages.

    Tip: In Lightning, you have to click the play button each time you access the Select Files user interface.

  3. Select Salesforce Reports from the drop-down list, select the folder for your Salesforce report, and then select the report you want to merge with the Microsoft Word template you added in step 2.

  4. With your Microsoft Word template highlighted, drag your report to the far-right grid.

  5. In Sheet/Range, type a value to assign a range name to your report. This range name will be used to tag your Microsoft Word template. For example, you can type AnyRange into Sheet/Range and the app will use AnyRange as the basis for all tags associated with this data merge in the template.

  6. In Filter, type pv0=Filter.

    Where pv0= is a filter parameter and where Filter is the filter from the report.

To add a dynamic filter to a DocGen Package

  1. In Salesforce, add a static filter to a Salesforce report.

  2. In Select Files of the DocGen Package, add a Microsoft Word document to serve as a template, then select the document from the middle grid. For more information on adding files, see Adding template files to DocGen Packages.

    Tip: In Lightning, you have to click the play button each time you access the Select Files user interface.

  3. Select Salesforce Reports from the drop-down list, select the folder for your Salesforce report, and then select the report you want to merge with the Microsoft Word template you added in step 2.

  4. With your Microsoft Word template highlighted, drag your report to the far-right grid.

  5. In Sheet/Range, type a value to assign a range name to your report. This range name will be used to tag your Microsoft Word template. For example, you can type AnyRange into Sheet/Range and the app will use AnyRange as the basis for all tags associated with this data merge in the template.

  6. In Filter, type pv0=Tag.

    Where pv0= is a filter parameter and where Tag is a tag from a field on the object from which the DocGen Package is run.

Merge Salesforce Reports to Microsoft Excel templates

You can also merge Salesforce reports to Microsoft Excel templates. You perform steps similar to the steps for merging with Microsoft Word templates, but instead of using range names for data, you assign sheets. If you want to merge more than one report, you will need more than one sheet in the Microsoft Excel template. You can merge reports with filters, both static and dynamic. The example used in the procedure below merges a report with a static filter to one sheet in the template and a dynamic filter to another sheet.

To merge Salesforce reports to Microsoft Excel templates

  1. In Salesforce, add a static filter to a Salesforce report.

  2. In Select Files of the DocGen Package, add a Microsoft Excel document to serve as a template, then select the document from the middle grid. For more information on adding files, see Adding template files to DocGen Packages.

    Tip: In Lightning, you have to click the play button each time you access the Select Files user interface.

  3. Select Salesforce Reports from the drop-down list, select the folder for your Salesforce report, and then select the report you want to merge with the Microsoft Word template you added in step 2.

  4. With your Microsoft Excel template highlighted, drag your report to the far-right grid.

  5. In Sheet/Range, type the sheet name on which you want to merge the report.

  6. (Optional) Repeat step 4 and 5 for every sheet name on which you want to merge a report. For example, you might want to merge a report with a static filter to sheet1, and merge a report with a dynamic filter to sheet2.

  7. (Optional) In Filter, type pv0=Tag to merge a report with a dynamic filter.

    Where pv0= is a filter parameter and where Tag is a tag from a field on the object from which the DocGen Package is run.

    The main advantage of merging a Salesforce report into a Microsoft Excel file is the ability to reference the data from another sheet. For example, you can merge all data from Salesforce report onto one sheet, then do calculations, concatenations and create pivot tables with that data on additional sheets. Once you have the data ready to present, you can hide the original sheet that contains all the base Salesforce data.

    Note: You can hide Microsoft Excel sheets that contain Salesforce report data.

Related information

Row replication in Microsoft Word

Row replication in Microsoft Excel

Tagging a Microsoft Word document

Tagging a Microsoft Excel document