Alternate Access Patterns For User Defined Data TypesLast Updated: 07/26/2016 Introduced in Verision: 2.0
This tutorial demonstrates how to use Alternate Access Pattern for User Defined Data Types.
Note: Alternate Access Pattern can be used only if User Defined Data Type is Database Stored.
Alternate Access Pattern is basically a query that has input fields defined at the time of Access Pattern creation. After Access Pattern is created, System generates a step that can be used in the Flow. This step will require input data for the fields it is configured to query against. Finally, it has a list of query types that we can pick from depending on our needs.
In this example we will create a simple User Defined Structure, then we will create several entities of this defined type. Finally, we are going to create an Access Pattern for this Defined Structure and test it in the Flow.
We begin in the Designer Folder with clicking Datatypes/Database > User Defined Types > Defined Data Structure [Advanced] on the Folder Actions Panel.
In the resulting Add Defined Data Structure window we Name our Structure. Then, we pick Database Stored Storage Type.
Next, we Add Data Members to our Structure.
When all Data Members added, we can click Ok to save our Defined Structure.
Our Designer Folder System generates a Defined Structure instance and Configuration Extension for the Defined Structure. We navigate to the Configuration Extension Folder for our Defined Data Structure.
In the Configuration Extension Folder we click Add Access Pattern on the Folder Actions Panel.
In the resulting window we provide our Access with Name and select which fields do we want to query against (these fields will be an inputs to the generated step). Click Ok, when finished.
Then, we return back to the Designer Folder and click Create Flow on the Folder Action Panel.
In the resulting window we Name the Flow and click Create to proceed to the Flow Designer.
This Flow will serve to create new instances of Employee and store them in the Database. First, we add Show Form step from the Favorite Steps category.
Next, we Name the Form and click Create to proceed to the Form Designer.
Our Form design is laid out to grab user’s inputs for each Data Member in our Defined Structure using Textboxes. When we finished designing our Form, we can save it and close Form Designer.
Next to our Form step in the Flow we add Create Employee step from Integrations > All Integrations > Defined Data Structures > Employee category.
Then, we add another Show Form step from the Favorite Steps category.
Name the Form and click Create to proceed. This Form is designed as following… It informs user that Employee was added and has two Outcomes: Add another Employee or Done. When finished designing this Form, we save it and close Form Designer.
Back in the Flow Designer we connect steps in our Flow as on the following figure. Then, we select Create Employee step on the workspace to configure data inputs.
In the Step Information Layer we click Show Mapping Editor.
In the Mapping Editor we select Build Data Mapping type for Item To Create.
Then, we connect outputs from the first Form to the corresponding fields in our Object. For the ID field in the Item we select Text Merge.Plain Mapping type and click Show Editor.
In the Text Editor we simply drag First Name and Last Name to the editor workspace. Click Ok to save and continue.
Then, for the Short Description we use Email Address from the first Form and for the Long Description we use Constant text. Save and close Mapping Editor.
This completes our Flow. We save it and close Flow Designer. Back in our Designer Folder we locate a thumbnail for our Flow, and Run Flow from thumbnail Action menu.
With this Flow we add several Employees…
Next, we create another Flow, where we will use Additional Access to get Employee by Email Address. Click Create Flow button on the Folder Actions Panel.
In the resulting window we Name the Flow and click Create to proceed.
In the Flow Designer we add Show Form step from the Favorite Steps category. This Form will serve for user interaction to grab the Email Address input.
We Name the Form and click Create to proceed to the Form Designer.
The Form design is simple. We use Textbox component from the Data category in the Toolbox for user input, and Button component from Actions category for an Outcome. When finished we save Form and close Form Designer.
Back in the Flow Designer we add GetEmployeeByEmailAddress step from Integrations > All Integrations > Defined Data Structures > Employee category.
On the Done outcome from GetEmployeeByEmailAddress we add another Show Form step.
This Form will display the results of GetEmployeeByEmailAddress step. We add Button component for Outcome and Data Grid component from List category. Data Grid component configured as following… In the Input Data we provide Name and pick Type of Employee (our defined data structure). Then, save the Form and close Form Designer.
Next, we connect steps in our Flow and select GetEmployeeByEmailAddress step on the workspace to configure it.
For the EmailAddress Input we use Select Value Mapping type and pick EmailAddress output from the First Form.
Mention, that we can configure Query Type for this step. In this example we use Equals query type because we need to get employees with the provided email address.
Next, we select our second Form on the workspace and configure it in the following manner… For Employee Data Grid component we use Select Value Mapping type and pick Results from GetEmployeeByEmailAddress step.
This completes our Flow configuration. We click Debug Flow link on the top panel of the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access the Debugger.
The First Form opens in the Debugger. We enter Email Address and click Show Employee button on the Form.
Then, the second Form opens and our Employee is displayed on the Data Grid component. Click Done.
Our Flow executes with no issues.