Document Generation

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.

Guideline for Creating Effective Templates

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.

Using Existing Documents as Sources

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.

Identifying Repeating Data & Conditional Content

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.

Gathering Information

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.

Stages of Setting Up CloudFiles Doc-Gen Templates

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 -

1 - Building Template

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.

  1. Select CloudFiles add-in > Login to your salesforce account
  2. 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
  3. 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 -

Document image


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.

2 - Previw the Template

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 -

  1. Click at Preview in the stage progress bar
  2. Enter the record ID
  3. 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 -

Document image


3 - Publish the Template

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:

  1. Go to 'Publish' from the Stage Navigation Bar.
  2. Select the appropriate publish option.
  3. 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.