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.
-
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.
-
Open the DocGen Package that you will use to merge a Salesforce report.
ExampleBelow you can see a report for our examples. It lists all accounts within a Salesforce organization and does not include a filter. You can merge this information into a Microsoft Word template.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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.
ExampleThis is an example of both methods of Microsoft Word tagging.
-
-
Once you tag your Microsoft Word document, you must upload and replace the document in Salesforce with the one you tagged.
-
Generate the documents for this DocGen Package by selecting Generate Documents on a record from the starting object for the DocGen Package.
ExampleThis is an example of the output file from the tagged document above. The locations of the Salesforce report columns are highlighted.
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
-
In Salesforce, add a static filter to a Salesforce report.
exampleBelow you can see the Salesforce report from the previous example, with a static filter added for Account Type. Once you save the report with this filter, you can use the filter in the DocGen Package.
-
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.
-
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.
-
With your Microsoft Word template highlighted, drag your report to the far-right grid.
-
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.
-
In Filter, type pv0=Filter.
Where pv0= is a filter parameter and where Filter is the filter from the report.
ExampleEntering the pv0= parameter allows us to control the Salesforce reports first filter with a value of Partner. Now instead of merging all the account records from the organization into our document, only partner accounts will be merged.
If the report had a second filter, we could control it by typing an ampersand (&) after the first filter, and then adding pv1= and the second filter. Tagging the Microsoft Word document with a filter is the same as tagging the document without a filter.
Both methods can be used. Below is an example of the output file from the tagged document above, filtered for partner accounts.
To add a dynamic filter to a DocGen Package
In Salesforce, add a static filter to a Salesforce report.
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.
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.
With your Microsoft Word template highlighted, drag your report to the far-right grid.
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.
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.
ExampleAbove is the same DocGen Package from the first and second examples. However, instead of using Partner as the parameter value in Filter, you use the tag <<Account_Type>>. This makes the filter value dynamic. When a user clicks Generate Documents, Nintex Drawloop DocGen® for Salesforce uses the data from the Type field on the record the DocGen Package was run from as the value for Filter.
A record on the Account object has the value of Analyst in the Type field. Because the tag for <<Account_Type>> was used in Filter, at run time the app inserts Analyst as the parameter in Filter.
Below is an example of the output file from the tagged document above, filtered for Analyst accounts.
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.
The Microsoft Excel template in this example contains multiple sheets.
To merge Salesforce reports to Microsoft Excel templates
In Salesforce, add a static filter to a Salesforce report.
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.
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.
With your Microsoft Excel template highlighted, drag your report to the far-right grid.
In Sheet/Range, type the sheet name on which you want to merge the report.
(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.
ExampleThe Microsoft Excel template in this example contains multiple sheets.
(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.
ExampleIn the example below, a Microsoft Excel document appears in the middle grid of the Select Files" section of DocGen Package Details. You select the template, select the Salesforce report, and then drag the report to the far right grid and assign the report to a sheet in the template. You can use the same template file to merge multiple reports, but you must drag and drop the file for each merge on a new sheet. In the example, a static report goes into Sheet1 and the dynamically filtered report goes into Sheet2.
When a user clicks Generate Documents, Nintex Drawloop DocGen® for Salesforce uses the data from the Type field on the record the DocGen Package was run from as the value for Filter and merges the data onto Sheet2. The data from the unfiltered report goes to Sheet1.
Below is an example of the dynamically filtered report that merged to Sheet2. Only Analyst accounts were merged into the Sheet.
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.
Row replication in Microsoft Word
Row replication in Microsoft Excel