How to Create a Template to Generate from a Salesforce Opportunity in Salesforce Classic Experience
This article will walk you through all the steps to build a template that can be generated from within a Salesforce Opportunity
Before you start building a template to be generated from inside an opportunity, please make sure you have already:
- Created a Connected App for Salesforce in Hub: Create A Connected App In Salesforce Classic Experience or Create A Connected App in Salesforce Lightning Experience
- Created a custom button for Hub document generation: Integrate RESTful Engine into Salesforce Opportunities
- Have installed Windward Designer on your machine: How To Install the Designer
Creating a template to be run from a Salesforce Opportunity
Start a Word document
- Open a new blank Word document.
- Give your document a name and save it to a convenient location on your machine, like your Desktop or Documents folder.
Connect to Salesforce Data
- Connect to your Salesforce Datasource. You can do this by following instructions here: Connecting to a Salesforce Data Source
Create a "uniqueID" Input Parameter
When generating a document from native inside of Salesforce, Salesforce will pass a unique identifier for the record you are on to your template. Let's create the Input Parameter that will receive this value.
- Click on "Input Parameters in the "Windward" ribbon
- Click "Add"
- Name the Input Parameter "uniqueID." (If you accidentally name this wrong, you can click "Rename" to change the name)
- Make sure the Input Parameter type is Text
- Click "Save" to save your Input Parameter
It is important that the parameter be named "UniqueID" and that the type is "Text." When you generate a document from inside Salesforce, the unique identifier of the record you are on will automatically look for an Input Parameter named "UniqueID" and will pass a text value.
Design your template
- Now you can start designing your template. For this tutorial, we will design a basic template just to demonstrate that the template and integration is working.
- Place your caret in the document, and insert a query tag by going to the Windward ribbon and clicking Tags -> Out
- Select your Out Tag and open the Select Wizard for the tag
- In the Wizard, find the "Opportunity" table (you can do this by scrolling or searching). Expand this table by clicking on it.
- Drag a record relevant to the opportunity into the "Columns" section of the Wizard. I will use the "Name" column.
- In the "Filter" section, click "Click here to add a group" and then "Click here to add a filter
- Click "Click here to select a node" to chose the data node you will filter on.
- In the dialog that pops up, find the Opportunity -> ID column. This is the same opportunity specific unique identifier that will be automatically passed to the document's "UniqueID" input parameter.
- Click "Click here to set the value. Using the dropdown that appears to the right of the text entry field, select the Input Parameter "UniqueID." Be sure that the comparison operator being used is "equal to" and change it if not.
- Click OK to save the tag.
Upload your template to Hub
- Log into the Hub portal as a user who is assigned access to the Salesforce Integration subscription.
- Click on "Document Templates" and then Upload Template
- Click "Choose File" and find your template.
- If you have multiple integrations, select Salesforce for your integration.
- In the "Integration Context" select "Opportunity."
- Click "Upload and Publish"
Configure a package template
Windward Hub generates "Package Templates" to output. A Package Template can consist of Windward Templates you want processed to output and also static files you wan't to be delivered with those templates.
- Click on "Package Templates"
- Click on "New Package Template"
- Select the files you wan't to be in your package template (make sure they are templates in the "Opportunity" context).
- Click "Configure Package Template"
- Fill out the required fields for the package template, namely the Package Name, Output Name and Output Format for each template, and any default values for input parameters.
- Click Create
Run your package template from Salesforce
- Inside of Salesforce, go into an opportunity.
- Click on your custom output button while in the opportunity.
- You will see Hub open in a new window. Select the package template you wish to output.
- Click "Run"
Your package template will be queued to run to output, and the output can be downloaded from the Output History tab in Hub.