Template Creation
Creating a template is the first step in generating documents using CloudFiles Doc-Gen. Here’s a step-by-step guide on how to create, preview, and publish templates using Microsoft Word and the CloudFiles Word add-in.
A well-crafted template determines how a merged document will appear and what information it will contain. To create a functional template in Microsoft Word, familiarity with document creation in Word is essential. The more proficient you are with Word, the easier it will be to style the final output effectively.
Most likely, you'll have source documents to work from, either electronic or printed, that you need to reproduce as templates. These source documents can quickly give you a list of data fields to collect. If you don't have an existing document, you can mock up a template and list the fields, their object, and any special formatting required.
Your template may include content common across all generated documents. For example, in a quote, you might want to insert your company logo, which should be present in every generated quote. Identify such content and build templates accordingly.
You may also want to set up conditions for including specific content in the generated document based on certain criteria. For example, different agreement points might be included in a contract based on an Account's ACV.
Identify and gather all the information you want to display on the merged documents. For instance, if your final document is an invoice, you'll need data about the account, order number, inventory levels, shipping information, price, and the sales representative. Data contained in the Salesforce Master Object where the CloudFiles Doc-Gen is placed will be automatically available to the Builder. All other data must be gathered by creating Resources.
By following these guidelines, you can create effective templates that ensure consistent and accurate document generation.
You can build as many templates as you need for any Salesforce object, preview them once built, and then publish them to make them available in your Salesforce Org for document generation.
Note - ‘Stage Progress Bar’ at the top in the add-in will help you track and navigate between different stages.
Below are the stages involved in setting up templates using CloudFiles Doc Gen -
In the Build stage, you select the Salesforce object you want to create a template for. Using various actions, you can insert object fields, related data, and custom resources. Besides field insertions, you can add pictures, tables, and set conditions for content insertion. You can also specify the title of the generated documents. Through the building stage, you will be able to utilize Template - Resources to retrieve data from connected Salesforce Org and design the template with these resources using Template - Actions.
Once the CloudFiles Word Add-in is installed and the Salesforce Org is connected, follow the walkthrough instructions given below to start building your own template.
- Select CloudFiles add-in > Login to your salesforce account
- Select platform as Salesforce and pick the record based on relevancy. (Here we will be using Account as the record)Platform > Salesforce and Record > Account
- Once you click on Submit, you will be directed to the next stage of selecting Template - Actions and utilizing various Template - Resources. You can use specific resources and appropriate actions according to your use case.
Refer to the GIF below to have a visual understanding of these steps -
We will create the template by inserting placeholders using actions. These placeholders will automatically be populated with the selected resources once the document is generated later in the process.
Once we have finished building the template, you can preview it for a particular record to ensure it produces the desired output before publishing. Follow the steps below -
- Click at Preview in the stage progress bar
- Enter the record ID
- Click on 'Generate preview'
A "Preview is generated successfully" message will prompt once the preview is generated. You can download and see the document by clicking Open against the message prompt. Refer to the GIF below to have a visual understanding of these steps -
After building a template in the 'Build' stage and reviewing it in the 'Preview' stage, the final step is to publish the template. Publishing makes the template available in your Salesforce Org for document generation on the specified object. Here’s how you can publish the template:
- Go to 'Publish' from the Stage Navigation Bar.
- Select the appropriate publish option.
- Click 'Publish' to publish the template.
Note:
- To publish as a new template for the object, check the 'Publish as a New Template' checkbox.
- To publish as an update to an existing template for the object, check 'Select an existing template' and choose an existing template from the drop-down.
Once the template is published, you can check the newly created or updated template from the 'CloudFiles Doc-Gen' widget on the object's page or from the 'Document Generation' tab of the CloudFiles app.