Menu

Different Flow types

A Dynamo template may contain more than just one Flow. Every has has the Main Flow that is generally tasked with producing a document, but Office templates typically have another Flow as well, tasked with customizing functionality into Action Buttons associated with the produced document. The typical traits of these two types of Flows in Office templates are :

  • The Compose Flow: also called as the Main Flow, decides how the Dynamo process would be in Salesforce, starting with gathering data for the templates, then processing the data, creating the document by filling data into the template and  finally providing different options to handle the outcome document if needed.
  • The Custom Button Flow: only available in Office templates, provide the functionality for the Action Buttons on Dynamo tab when previewing the document created by Dynamo in Office applications. When end-users download the created document and opened it with Office application, they have finished the Compose Flow and left Salesforce, meaning the Dynamo process has ended. In order for end-users to continue their document-driven process and still benefit from Dynamo, we need to create a separated Flow with added functionality into the Dynamo add-in. The extra functionality is presented as buttons in the Dynamo add-in, under the "Actions" group, so called Action Buttons. The functionality of Action Buttons can be customized in different templates. Thus, Action Buttons work only for those documents have been created by a specific Dynamo template.

The Compose Flow

Every Dynamo template includes a Compose Flow (or Main Flow), this Flow tasked with "composing" the result document filled with dynamic content. A Flow doesn't produce anything without being ordered to do so, though. The Flow-specific tag related to this is composeContent, which takes a document template with tags and dynamic parts, and composes a result document out of it. Naturally, this tag needs to be somewhere within the Compose Flow.

The basic structure of a Compose Flow is as follows:

  1. Gathering and processing data: The Flow starts with Steps and/or Forms that gather data for the template through querying and taking user input. Sometimes the data received through queries might not be in a form suited to what the template needs and therefore may need to be refined into a different kind of data structure.
  2. Creating the document: When the required data has been acquired, a Step with composeContent is evaluated. The tag produces the resulting document from a template resource. This template resource is often a resource within the Document application archive, or in case of Office templates, the document itself can serve as the template resource. However, the template to be composed can be any document found in the variable context, so it could, for example, be a document downloaded from Salesforce.
  3. Following actions: After a composed document has been produced, something should be done with it or it will disappear along with the Flow's conclusion. The following actions can be different in each template, depending on the document-driven process.

1. Gathering and processing data

Example in the picture, a Compose Flow starts with "Start" Step, following by an "Options" Form.

When clicking to Edit Step in the "Start", you will find all the logics used to gather correct data, such as getting all the neccessary Salesforce fields in the Main Object, User object and Related Line Item, or giving a dynamic name for the outcome document.

The "Options" Form is to give end-users different choices on how they want the out come document to be.

End-user selection will be collected and used to process data in later steps. You can have many Steps and Forms to gather and process data when preparing for the creation phase.

2. Creating the document:

The real document creation process usually happens in one "Compose" step.

The "Compose" step includes the logic to select the right template parts and merge the appropriate data into those parts. In some complex cases, there might be multiple steps in the creation phase, for example Dynamo will select the document's language, merge data from the corresding language into multiple template parts, and arrange their orders.

After the "Compose" steps, the Flow can continue with the Following Actions such as exporting PDF version for download or allowing customization, etc.

Note:

In some cases one might make use of the fact that a Flow can contain multiple composeContent tags. Since the chosen template resource is composed with the variables currently in the variable context, composing the same template twice but changing variables between the tags results in a different product. Similarly, one can use several template resources to produce different documents in one run of a Flow (example in the picture). However, please note that this option is only for Online Templates and DOES NOT work if the Flow is in an Office Template where the composeContent is composing that template itself.

3. Following Actions

Since Dynamo offer the flexibility to create Steps and Forms, there is no fixed action what going to happen after the "Compose" step, neither how end-users will interact with it. A few common Follow-up options to have are:

  • "Download": Have a Form with a link allowing the user to download the document. The document can also be stored into Salesforce. This option is often used in Office Templates, as end-users need to download the created documents in their original format (docx, pptx, xlsx) to open and edit them in Office application.
  • "Preview": This is a variant of the "Download" form, in which  instead of having a download link, end-users can select the button "Edit before saving", which will trigger either download the documents (if using Office Template), or open the document to edit in browser (for Online Template). The "Save PDF" button can open the PDF version of the outcome document for previewing and save it straight to Salesforce.
  • "Save and Send": The outcome document can be emailed to customers. Saving the document in Salesforce or updating the new version of the document also happen here.
  • "Internal approval": After creating the document, Dynamo can trigger an approval process in which outcome document can be sent for internal collaboration and approval. Extra comunication with Salesforce to update the record data is sometimes required.

The Custom Button Flow

The Office templates will define Action Buttons to appear when the document created by Dynamo is opened. The functionality for these buttons is provided by a Flow called the Custom Button Flow. A single Flow handling the effects of all buttons is achieved by making the Flow have different routes for every button, and the way to make Flow take the correct route is to use the Segments' event mappings.

The basic structure of a Custom Button Flow is therefore to have a Segment containing the Steps for each button's logic. Each button, when pressed, starts the Flow with a different initiating event and the Segment has event mappings corresponding to each of these events. The mappings lead to the Steps with logic doing what the event-sending button is expected to.

The Custom Button Flow in the picture includes steps to define the what will happen when end-users select the "Save" and "Send" buttons in the Actions group below:

Note:

The Action Button "Save" is in Actions group. They function differently than the general "Save" button in File group (below picture). Functionality and naming of the Action Buttons are customizable by the template designer, while functionality in the File group is fixed by Dynamo. The Actions group appear in Dynamo tab only when you open a document that created by Dynamo. The File group appear in normal Word document or the template files.

Comments

0 comments