Gonexa University

Initial training


The Gonexa Doc solution is Gonexa's historic solution for generating a document from a template in the format .docx. xlsx .pptx .pdf

Manage tables

Insert items related to your main context in the form of tables

We're going to go through 3 simple steps to achieve this:

  • Creating multiple tables in a document
  • Filter these tables to show only relevant data
  • Sort the tables by the criteria of your choice

Prerequisites

BEFORE STARTING
  • Have a template already ready with the main object configured
  • Take a use case where the main object has many related elements (e.g.: Opportunity, Quote, Account,...)
WHY USING TABLES?

A table corresponds to a related list in Salesforce. For example, if I am on an account, the contacts are children of the account. If I find myself on an opportunity, the opportunity products are children of the opportunity.
These relationships can be standard or built using custom objects. Gonexa technology will simply allow you to display information related to your context.

Many use cases are possible such as displaying the products, services, and options related to my business opportunity in 3 separate tables in my document even though they are all in the same Salesforce object (ProductLineItems).

Create tables

STEP #1
Add child objects to Salesforce
  • In your document template, click on the “Objects” tab to access the list of linked objects
  • Click on “New” in the “Children object” section
  • Select the Salesforce object linked to your context (e.g. opportunity products linked to the opportunity)
  • Rename the tag label carefully if you want to have multiple arrays on the same child object
  • Click on “Create”
  • Repeat the operation several times with a correctly named label each time (e.g.: Label 1 = Product, Label 2 = Service, Label 3 = “Option”)
  • We finish this part by clicking on “Open Assistant” to facilitate the insertion of information into the final document.
Inserting tables in Word

This step is based on standard tables offered by Word. For more simplicity, feel free to use our pre-designed templates available on our website.

  • Insert a new table with 2 rows and the number of columns you want
  • The first line will allow you to have the names of the columns, name the columns as you want
  • On the 2nd line, we are going to use the Wizard that we opened earlier to put the tags
  • Click on the desired child object and look for the field according to what you want to put in your table
  • Finalize the template with all the fields you want to see displayed



To make it easier to understand, you can download the template shown during the demonstration below:

Template upload and testing
  • Go back to Salesforce and upload the Word template with the tables by clicking on “Upload version”
  • Make sure you have a test record with children
  • Test the generation to see the final result

Filter data

STEP #2

Filters ensure that you only see data that is relevant to your context. Here, we want to filter only the “Product” category in the 1st table, the “Services” in the 2nd, and the “Options” in the last. We use the same Salesforce object 3 times but with different views.

Identification of the filter to be used
  • Knowledge of your Salesforce is essential to know the right filter to use and who will be the one fed with the right data.
  • If the field that can filter the data has not yet been created, you must create it and ensure that it is populated.
Addition of the condition on the child object
  • In the “Object” tab, click on the label (e.g. Product, Service, or Option)
  • In the “Conditions” panel, click on “New Condition”
  • Find the field to use for the filter
  • Indicate the operator and the expected value (ex: Category = “Product”)
Checking the filter
  • Go back to your context (Quote, Opportunity,...)
  • Make sure you have completed data on the filtered field
  • Generate to verify that the filter has been applied

Sort data

STEP #3

This step is optional since it will simply improve the organization of the data in your table a bit at the time of generation.

Identify the sorting criteria
  • Same as for the filter, you need to identify the right field that will allow us to sort dynamically
  • Make sure there is a link with the child object
  • If this field does not exist, you will have to create it as well
  • Get the API name of the field, it will be needed for the filter
Add the filter to the child object
  • Go back to the child object you want to filter
  • In the “Sort Request” area, specify the API name of the field to be filtered
  • Put a space + ASC or DESC next if you want to sort ascending (ASC) or descending (DESC)
  • Example: “TotalPrice ASC” if I want to sort the product line from the largest total amount (TotalPrice) at the top to the lowest at the bottom
Sorting check
  • Go back to your context (Quote, Opportunity,...)
  • Make sure you have the data filled in on the sorted field
  • Generate to verify that the sorting has been applied

Grouping data

STEP #4
Group items according to a Salesforce criteria

Group all the elements of a child object that correspond to a criterion, that is, group the rows of a table in a Word document according to a Salesforce field such as the family of a product for example.

From the child object of your document template:

  • Name the field “Group Name” in any way you want. Ex. Group
  • In the “Field to group on” field, fill in the API name of the field on the child object on which to group (it can be an object based on the child object or on a parent object of the child object)
    Ex. Quantity or Product2.Familly
  • From your Word document template, create a one-row and one-column table from which you will fill in the Group Name tag constructed as follows:

    {!GroupName|APIName of the field to group on}

    Ex. {!Group|Product2.Family}
  • Then insert your child object's array into this initial array. The table (in its entirety) will be repeated according to the number of results that correspond to the criterion and with the name of the family in the header.
  • In the 3rd row of the table, insert the table of your child object containing the tags, adjusting the columns and the borders. This is the table that will be visible.

    You can also change the properties of the table by choosing the value “Around” as “Text wrap”.
  • The table, in its entirety, will be repeated according to the number of results that correspond to the criterion and with the name of the family in the header.

Word configuration vs generation result