Using the Approvals ModuleLast Updated: 12/05/2018 Introduced in Version: 3.2
This tutorial demonstrates how to use Truth Table and simple Approval Chain to create ad hoc approval applications.
In this example use a Truth Table that outputs an Approval Chain based on the input.
Note: install the Approvals feature in Decisions to access some steps. This feature can be found under System > Administration > Features.
Begin in the Designer Folder with clicking Create Rule > Create Truth Table on the Folder Actions Panel.
Then, Name the Truth Table and select Create to proceed to the Rule Designer.
In the Rule Designer locate Output Section and using Output Type picker select Approval Chain type.
Then, Ignore Outcome Data [Default].
Next, in the Rule Input Data select Show Editor link to add an input for the Truth Table. Name the input and define its type String. Select Ok to save and close Rule Input definition window.
Next, on the workspace are going to define a condition for the Truth Table. First, select [Select Data Element] and select Rule Input that was defined for this Truth Table.
Next, select [Pick Verb] and choose Equals verb for the Truth Table condition.
Then, wselect the empty dashes link under ApproverEmail Equals and define a Constant ‘firstname.lastname@example.org’ Email.
Next, under Result select the empty dashes. Because the Truth Table outputs Approval Chain, build a Constant Simple Approval Chain. For the Approval Chain Value, select ellipses to create an Approval Chain. In the resulting window, Add Account to the first level of approvers. This is done by typing the name or email of an approver. Decisions will try to auto-complete the name based on accounts that exist within Decisions.
When the account or group appears in the auto-complete, pick that and click Ok.
Then, select add row link to create the second case of the Approval Chain.
In the same manner, define Constant Input email to the Truth Table and create Constant Approval Chain. Add Account to the first level of Approvers. Chose an existing Account that matches the Input for this row and select Ok. Save and close row definition editor.
The Truth Table is completed. Save it and close Rule Designer.
Next, create a simple Flow to demonstrate the use of the Truth Table that outputs Approval Chain based on the input. In the Designer Folder, select Create Flow on the Folder Actions Panel.
In the resulting window, Name the Flow and select Create to proceed to the Flow Designer.
In the Flow Designer, add Show Form component from the Favorite Steps category. Create a simple Form where User should be able to pick Approver.
In the resulting window, Name the Form and select Create to proceed to the Form Designer.
The Form is designed with a Title (Label component), Radio Button List that represents two options for the Truth Table, and a Submit Button. When finished designing the Form, save the Form and close Form Designer.
Back in the Flow Designer, add the Truth Table. Add [Pick or Create Truth Table] step from the Flows, Rules, Forms, and Reports > Rules category.
Then, select Pick or Create Truth Table link.
Next, locate the Truth Table and click Pick.
In the resulting window pick Select Value Mapping type for Approver Email input to the Truth Table.
Then, using Path picker select Approver outcome from the Form and select Ok.
Next, add Get Approval step from Integrations > Approvals > Approvals Core category, or it can be found using the search function.
Then, connect all outcomes from the Get Approval step to the End step in our Flow.
Select Get Approval step on the workspace and select Edit Input Mappings option.
In the Mapping Editor, connect First Approval Chain from the outcome from the Truth Table to the Approval Chain field. Then, for the simplicity of this example, Ignore other inputs into Get Approval step. Save and close Mapping Editor.
This completes our Flow. To test it, select Debug link on the top panel of the Flow Designer.
This Flow is executed under an admin Account. Select admin Account on the Form and click Submit.
Then, the Flow executes to the end with no issues.