Form Outcome RulesLast Updated: 06/07/2018 Introduced in Version: 2.0
A form displays controls that allow a user to perform an action, such as enter data, display a report or folder, or manage entities. You can create a flow that, when run, opens a form. It is possible to create a custom Rule that can be used to control Form’s Outcome behavior.
In this example we will create a Rule that will be used to control our Form’s behavior. Our Rule will create a condition to show Notification when user selects Admin email from the list of emails on the Form.
We begin in the Designer Folder with clicking Create Rule > Create Rule on the Folder Actions panel.
Next, we name the Rule and click Create to proceed to the Rule Designer.
In the Rule Designer we click Show Editor link to add new Rule Input Data.
In the Data Definitions dialog, we Name our input, select its Type as Account and check Is List check-box.
Then, we can click Ok to save and close this pop-up window.
Back in the Rule Designer Properties panel, in the Output section we change the Behavior Type to Form Rules.
First, we expand our Rule Input data and select List Of Emails. Click Next to continue.
Here, we expand Text Rules category and select Contains Any. We click Next to proceed…
Finally, we define the Input as, Constant and the value as, firstname.lastname@example.org for the List of Emails. Click Done to complete this Rule Phrase.
Click Close in the top panel to save and close the Rule Designer.
Back in the Designer Folder we click Create Flow button to create a new Flow. We name the Flow and click Create to proceed to the Flow Designer.
In the Quick Add for Step, we add GetAll step from All Steps [Catalog] > Integration > Internal Services > AccountService category.
Next, we expand Flows, Rules, Forms and Reports > Forms [Interaction] category and add [Pick or Create Form] step to our Flow.
In the resulting pop-up window we click Pick or Create Form link. Then, in the Create New field, we name the Form and click Create to proceed to the Form Designer.
In the Form Designer we add Button control from Actions category in the ToolBox. Next, we add Check Box List component from the List category in the ToolBox.
Then, we need to configure this Check Box List component. First, we define List Items Data Name. We use Type Picker to select Account Type for this list. Next, define Selected Item Data Name, and use our Button control as an Optional Outcome for this list.
Next, we pick EmailAddress for Display Field option…
To navigate to the Form’s properties we select Explorer on the right panel. In the Explorer we select Surface component and click Properties.
In the Surface Properties we locate Outcome Rules configuration and click Add New link.
In the resulting pop-up window we define Name, Outcome Path, and Triggers for our Rule and click Add New link to configure Rule Data.
In the Add Rules window we provide RuleName and use Rule Picker to select the Rule that we have created previously in this tutorial.
After we picked the Rule we need to configure Inputs to this Rule. Click Update Inputs then click the pencil icon to edit the Inputs.
In the Edit Inputs dialog we select Form Component option from the Input Type drop-down list.
Next, from FormDataName drop-down list we select Selected Accounts which is a data name for the user’s selection from the list of Emails. Then, we can save and close all dialog windows for Outcome Rule configuration. This completes our Form. We can save and close Form Designer to return back to the Flow Designer.
In the Flow Designer, we add Show Popup step from the Favorite Steps category in the Quick Add Step dialog to the AdminEmail outcome from our Form. This outcome from our Form was created with Outcome Rule. In this case we want to show a Notification to the user when the Outcome Rule evaluates True (in other words, when user selects Admin email).
In the resulting window we configure Subject and Message for our Show Popup step.
We connect Steps in our Flow in the following manner:
Next, we select Edit Input Mappings from Form step options in our Flow. In the Edit Step dialog under Inputs > Accounts we click the Select Value [Form Flow] and choose GetAll_Output to populate the Check List in our Form with all Accounts in the system. Set the Selected Accounts to Ignore. We can save and close Mapping Editor when finished.
This completes our Flow. We can click Debug link from the top panel in the Flow Designer to test our Flow. Our Form opens in the Debugger and the Check Box List is populated with all Accounts. We can select several Accounts from this List.
When we select email@example.com email from this List we trigger our Outcome Rule. As expected, Notification pops up and our Form resets.