Truth Table and Simple Approval ChainLast Updated: 07/15/2016 Introduced in Verision: 3.2 |
This tutorial demonstrates how to use Truth Table and simple Approval Chain to create ad hoc approval applications.
Example:
In this example we are going to use a Truth Table that outputs an Approval Chain based on the input.
We begin in the Designer Folder with clicking Create Rule > Create Truth Table on the Folder Actions Panel.
Then, we Name our Truth Table and click Create to proceed to the Rule Designer.
In the Rule Designer we locate Output Section and using Output Type picker select Approval Chain type.
Then, we Ignore Outcome Data [Default]…
Next, in the Rule Input Data we click Add New link to add an input for the Truth Table. We Name the input and define its type String. Click Ok to save and close Rule Input definition window.
Next, on the workspace we are going to define a condition for the Truth Table. First, click on [no anchor data] and select Rule Input that we defined for this Truth Table.
Next, we click [n/a] and pick Equals verb for the Truth Table condition.
Then, we click [ignored] link under ApproverEmail Equals and define a Constant ‘admin@decisions.com’ Email.
Next, under Result we click [ignore]. Because our Truth Table outputs Approval Chain, we can build a Constant Simple Approval Chain. For the Approval Chain Value we click ellipses to create an Approval Chain. In the resulting window we Add Account to the first level of approvers.
Then, we are going to pick admin Account because this is the case of Truth Table where the input will be admin Account. Click Ok to confirm picked Account.
Save and close Approval Chain editor and close the Result Mapping Editor.
Then, we click add row link to create second case of the Approval Chain.
In the same manner we define Constant Input email to the Truth Table and create Constant Approval Chain. Add Account to the first level of Approvers.
Pick an existing Account that matches your Input for this row and click Ok. Save and close row definition editor.
Our Truth Table is completed. We can save it and close Rule Designer.
Next, we are going to create a simple Flow to demonstrate the use of the Truth Table that outputs Approval Chain based on the input. In the Designer Folder we click Create Flow on the Folder Actions Panel.
In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Show Form component from the Favorite Steps category. We are going to create a simple Form where User should be able to pick Approver.
In the resulting window we Name the Form and click Create to proceed to the Form Designer.
Our 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, we can save the Form and close Form Designer.
Back in the Flow Designer we add our Truth Table… Add [Pick or Create Truth Table] step from the Flows, Rules, Forms and Reports > Rules category.
Then, click Pick or Create Truth Table link.
Next, locate our Truth Table and click Pick.
In the resulting window pick Select Value Mapping type for ApprovalEmail input to the Truth Table.
Then, using Path picker select SelectedApprover outcome from the Form and click Ok.
Next, add Run Approval Flow step from Integrations > Approvals > Advanced category.
Then, we simply connect all outcomes from the Run Approval Flow step to the End step in our Flow. In this example we are not going to build any additional processes on each outcome from the Run Approval Flow step because it is out of this tutorial’s scope.
Select Run Approval Flow step on the workspace and select Show Mapping Editor option.
In the Mapping Editor we are going to connect First Approval Chain from the outcome from the Truth Table to the Approval Chain field. Then, for the simplicity of this example we Ignore other inputs into Run Approval Flow step. Save and close Mapping Editor.
This completes our Flow. To test it, we can click Debug Flow link on the top panel of the Flow Designer.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.
We are executing this Flow under admin Account. Select admin Account on the Form and click Submit.
The Flow keeps executing and the Approval Form is being assigned to us because admin Account input to the Truth Table caused it to output an Approval Chain where admin is the only responsible approver. We click Yes to fill in the assigned Form.
The Approval Form opens up. We fill it in and submit.
Then, the Flow executes to the end with no issues.
Next, we are rerunning the Flow and select different Approver. This time Truth Table executes with different Approval Chain and assigns Approval Form to another account.
We log in as the assigned user…
The assigned Approval Form shows up on the Home Page.
We click it and select to fill the Form in.
Fill in the Form and submit.