Gonexa University

Flows & Gonexa

Automate actions related to document generation by leveraging the power of Salesforce flows.

We are going to break this training down into 4 steps :

  • Main principles of flow, action triggered on the update of a record
  • Introduction to Flow Actions
  • Generate a document individually
  • Generate documents from a list view

Prerequisites
✓ Ensure that on-click generation is working
✓ Understand the process to be implemented

Flow Demo Org

Find our flow examples

☝️ Access the Pre-built Flow Org

Visit our example flow org for inspiration. Discover the most common use cases from our clients.
⚠️ A verification code will be required to log in. Please contact support to obtain it.

  • address: login.salesforce.com
  • identifier: tester@gonexa.fr
  • password: Gonexa01

Attention
Un code de vérification vous sera demandé pour vous connecter. Veuillez contacter le support afin de l'obtenir.

Gonexa & Flows

Save time and eliminate repetitive actions with Salesforce flow actions.

Create a new flow
  • From Salesforce Setup, go to Flows (flow), then click New Flow.
  • Select the type of flow to set up from the following options:
    Screen Flow

    Display settings or information to the user before launching an action on click
    Ex: Choosing the template and output format before generating on click
    Record-Triggered Flow

    Trigger an action when a Salesforce record is created, updated, or deleted
    Ex: Automatically generate a document when a status is changed
    Schedule-Triggered Flow

    Trigger a specific action at a scheduled time
    Ex: Generate all tax receipts every December 31st at 9:00 AM
  • Click "Create"
Creating a recordID variable

Tip
The recordId variable is used in almost all screen flows. It is used to create the recordId field and provide the flow with the context from which we are launching the generation.

  • From the toolbox, click on New Resource
  • Choose the type: Variable and give an API name
  • Select the Text data type, to store the id of the record to be generated.
  • Check the box: Available for entry
Add an informational screen
  • Name the label and the API name
  • Name the label and the API name

    Tip
    In the screen properties, rename the "Next" button in the footer configuration to improve the user experience.

  • Drag and drop the desired component: date, checkbox, informative text...
  • Validate
Add an update action

To update the data entered in the previous screen, you can add an update action. It will trigger a next action.

  • Name the label and the API name
  • Name the label and the API name
  • Check the box: specify conditions for identifying records
  • Select the Salesforce object from which the field is to be updated (e.g. Quote)
  • Filter conditions with the record Id = the previously created recordID variable
  • Define the fields to be updated and their values. (Ex. ExpirationDate = Expiration Date and Status = Review)
  • Validate, save, name, and activate your flow.
Provision of the flow

Place the feed on your context.

  • Access your main object from Salesforce (the object from which the action is triggered)
  • Click on edit page
  • Drag and drop the Flow component to the desired location
  • Select the flow you want to call from the dropdown list
  • Check the box: transmit the ID of the record in this variable

Generate automatically

Our most famous action that will allow you to generate a document automatically

Action name: “Generate a document”

UNITARY GENERATION ACTION

Build your process at your convenience (screen, decision, success message...) and add the Gonexa action.

The 3 parameters of the Generate a document action
  • Add an item to your Action flow
  • Select the Generate a document action: apex-gnc__documentGenerationInvocable
  • Fill in the following 3 items:
    Output format

    Calls the pdf, xlsx, pptx, or docx value. You can set this value as a variable using a screen by creating new choice-type resources.
    RecordId

    Retrieves the ID of the record to be generated. This value should be set as a text variable available for input.
    TemplateId

    Retrieves the ID of the document template to be generated. This value can be set as a variable in a screen or selected from documents based on criteria such as the document name.
  • Add a Get Records element to your flow
  • Save, activate, and test

Action name: “Generate a document (Future)”

UNITARY GENERATION ACTION

This flow action is similar to the Generate a Document action, the configuration is similar.

Note
Salesforce does not allow more than 50 future actions at once, so be careful with trigger flows that use this action if the trigger could be called more than 50 times simultaneously.

Bulk Generation

Whether from a list view or from a trigger, mass generate documents

Action name: “Generate multiple document (<50,000 records)”

Mass generation action

Generate several documents at once from a list view.

Get records
  • Give it an API label and name
  • Retrieve records from the object in your context. (Ex. The generation of certifications (from contacts)
  • Filter records with the following requirement:

    Field: Id
    Operator : in
    Value : ids

Create the ids variable

To fill in the value field, create a new resource:

  • Resource type : Variable
  • API name: ids
  • Data type: Text
  • Allow multiple values (collection)
  • Available for entry
  • Validate

Note
The name is case-sensitive; you must name it exactly "ids".

Add the Generate Multiple Document action

Add action on the page layout of your main object.

  • From the configuration object manager, access the object from which you want to start the generations.
  • Go to the Buttons, Links, and Actions tab
  • Create a new button such as List button
  • Name the label of your choice (e.g. generating certifications)
  • Paste the feed URL into the link.
  • From the layout tab of the list view button, add the new button and save.
  • Validate and test

Tip
You can find your flow URL in the flow details.

Dynamic variables

Use a flow variable as data in a document

Inserting dynamic variables into a document

Sometimes you need to display one or more dynamic values when generating a document.

In a Salesforce flow:

Create a collection variable

Start by creating a collection variable in your feed. This variable will store the data you want to show in your document.

Assigning values to the collection variable

Add an assignment action to assign the desired values to the collection variable. The order of the assignments will determine the order of the tags to be positioned in the document.

Fill in the collection variable in the generation action

In the document generation action, activate the “Collection of Dynamic Values” parameter, then enter the collection variable used previously.

Position tags in the document

In your document template, position Gonexa tags to show dynamic values upon generation.

Dynamic tag

The syntax {!gnxdynamic|1} displays the Nth value of a collection variable.

Parameters:
N
= index of the desired value (starts at 1)

Example
With a collection variable containing "Paris, Lyon, Marseille, Bordeaux", {!gnxdynamic|2} will display the second value in the list, which is Lyon.

Convert to PDF & Merge

Use this flow action to convert or merge documents

Action name: “Convert to PDF”

This flow action allows you to convert a document into a PDF, and also allows you to merge several documents into one.

In a Salesforce flow:

Add the Convert to PDF action
  • Content Version ID : Enter here the ID of the Content Version to be converted to PDF, or to which you want to add documents as appendices
    You can retrieve this value by obtaining a record in the stream.

In case you want to merge several documents, create a collection variable to store appendices

  • Annexes IDS : Enter here a collection variable in which you have stored the IDs of the documents to be added to the main document.
    Content Version IDs are expected here
    You can retrieve the documents via a screen or by using a registration form in the flow, for example.

Tip
A sample flow is available in the pre-built flow Org.

Dynamic filter

Use dynamic filters in a flow to filter data

Action name: “Create a dynamic filter”

The use of dynamic filters allows the user who generates his document to choose which filter to apply to a child object of the document model.

Generating with dynamic filters can only be done via a Salesforce flow.

In a Salesforce flow:

Add the Create a dynamic filter action
  • Condition on query : Enter the condition for retrieving the records here. What is expected is what comes after the Where of a SOQL query
  • Document template object Id : Enter here the ID of the child object of the document template concerned by the filter.
    You can retrieve this value by obtaining a record in the flow.
Create a collection variable

Create a collection variable in your feed. This variable will store the result of the dynamic filter.

Assigning values to the collection variable

Add an attribution action to assign the result of the dynamic filter to the collection variable.
To do this, you have to

Fill in the collection variable in the generation action

In the document generation action, activate the “Collection of Dynamic Filters” parameter, then enter the collection variable used previously.

Tip
Two sample flows are available in the pre-built flow Org.

Send e-mail with an attachment

Use a flow to email a document

Action name: “Send e-mail with attachment”

Sometimes you need to send an email with an attachment.

In a Salesforce flow:

Add the Send Email action

Fill in the expected parameters:

  • Contact or User ID : Enter the ID of the contact or user you want to email. You can retrieve this value by obtaining a record in the stream.
  • Email Template ID : Enter the ID of the email template you want to use for sending. You can retrieve this value by obtaining a record in the flow on the EmailTemplate object for example.
  • Content Document ID : Enable this setting to add a document as an attachment. You can retrieve this value using a Get Records element in the flow.
  • Related To ID : Enable this setting if you want to link the activity to a specific record in addition to the contact. Enter the desired record ID; you can retrieve it using a Get Records element in the flow.

You can add other parameters to the action, such as adding a copy of a recipient, adding a custom shipping address, or displaying a sender name

Tip
A sample flow is available in the pre-built flow Org.

Tag each generation

Tag each generation to better monitor and manage post-generation actions.

Enter a variable in the generation actions

You sometimes need to create automations following the generation of a document, such as sending by email or signature for example.
In a Salesforce flow, you can identify each generation and find that information in the generation log.

In a Salesforce flow:

Add the build action
  • Enter the usual expected parameters
  • Activate the “Generation Tag” setting
  • Enter a descriptive value in this field, such as the flow name or any information useful for clearly identifying the generation in the generation log.

Note
Text is limited to 255 characters.

  • Save your feed
  • When a document is generated via this flow, the “Generation Tag” field in the generation log will automatically take the value defined

With this information in the generation log, you can simply define the conditions for triggering your automations later.