CaseCloud provides a reusable flow, HotDocs: Sample Generate Document Flow, for generating HotDocs documents. It includes a screen for a user to select from a list of templates and then allows assembling of documents & saving them to the source record.
Understanding the Sample Generate Document Flow Template Structure
This document outlines the structure and functionality of the sample Salesforce Flow template designed for automated document generation. The flow is broken down into three logical sections, as shown in the diagram above.
Section 1: Flow Initiation and Data Gathering
This initial section is responsible for starting the flow and collecting all the necessary information required for document generation.
- Flow Trigger: The provided sample uses a Screen Flow, which is ideal for scenarios that require user input, such as template selection. This trigger is fully customizable and can be configured to use any of Salesforce's initiation mechanisms, such as a record-triggered flow for data changes, an autolaunched flow for backend processes, etc., depending on the automation requirement.
- Key Steps in this Section:
- Get Account: The flow begins by fetching data from the current record where it was launched. It uses an input variable, typically
recordId, to identify and retrieve the correct Account, Opportunity, or other object record, assuming the flow is being launched from a record's context.
- Get HotDocs Document Templates List: This step runs a query to find all active HotDocs Document Templates that the user has access to.
- HotDocs Document Template Selector: In this screen flow example, a screen is presented to the user that displays the list of templates gathered in the previous step. The user selects the desired document template to use for document assembly.
- Get Account: The flow begins by fetching data from the current record where it was launched. It uses an input variable, typically
Section 2: The 'Assemble Documents' Core Action
This is the central and most critical part of the flow. It uses the Apex Action provided by CaseCloud to handle communication with the document generation engine.
- Apex Action: Assemble Documents: This action allows documents to be assembled in the background and automatically attached to the source record. For more details, follow this link.
Upon execution, this action sends the specified data to HotDocs, which generates the document(s) in the background. It then creates a HotDocs Interview record in Salesforce to track this transaction and store the resulting documents.
Section 3: Finalizing and Navigation
This final section completes the user's journey by seamlessly guiding them to the process's output.
- Action: Navigate to Record: Once the
Assemble Documentsaction successfully creates theHotDocs Interviewrecord. The flow then automatically redirects the user's screen to display the assembled documents list.
(This Flow Action is provided by CaseCloud HotDocs Integration for Salesforce.)
To launch this sample flow and see it in action, add the Generate HotDocs Documents action button to your account page layout or Lightning record page.