Last Updated: 08/11/2016Introduced in Verision: 2.0
When building a flow, use the Create or Copy Data component to create or copy data objects (or lists of objects) for use elsewhere in the flow. For example, select the Create or Copy Data component and, using the Mapping Editor, add a list of assets such as a computer, monitor, and printer to the hardware catalog. This list can then be used by a Hardware Request form that opens when the flow runs.
Another useful application of the Create or Copy Data component is for error handling, by setting a true/false flag when an error occurs. An example of that follows this first example scenario.
The Create or Copy Data component can be found in the Toolbox panel, under the category Data.
Hardware Request Example
Our first example flow opens a form that allows a user to request an asset from the hardware catalog. We will add three items to the catalog using the Create or Copy Data component. The user can then select from these assets in the form’s drop-down lists.
The form, Display Hardware Form, has been created for this example. The drop-down menu is of type “string” and will be populated by the Create or Copy Data step preceding the form.
Begin by navigating to a Designer Folder and clicking the Create Flow button. Give the flow a name and click OK to open it in the Flow Designer.
To start building the flow, in the Flow Designer’s startup window, select a Create or Copy Data component from under the All Steps [Catalog] > Data category and click Add to add it to the workspace.
To set the data definition for the type of data Create or Copy Data 1 will use, in the Properties panel, click the Add button under Data Definitions.
In the resulting Edit object pop-up, enter a name for the data, such as “Computer,” then click the Type selector to define the data type.
The Create or Copy Data component will create a string list, so we use the search field to enter “string,” then select the String data structure and click OK.
Check the “Is List” checkbox to indicate that there will be multiple hardware items (i.e. an array).
To save the data definition, back in the Edit object pop-up, click OK.
Next, use the Mapping Editor to add data (computers) to the string. Select the Create or Copy Data step and click the Show Mapping Editor link from the Properties panel, or from the step’s Actions menu.
Click on Select Value for the Computer input, and set the mapping option to Constant. In the Value box, type the computers to make available in the form.
These are all of the computers for the hardware catalog for now, so click OK to close the Mapping Editor. Note that back in the Properties panel for the step, it is also possible to create computers under the Inputs > Computer section.
Next, add the form that will use these new assets to our flow.
In the Toolbox panel, in the Forms [Interaction] > [Current Folder] category, drag a Hardware Request Form component to the workspace. Connect the Create or Copy Data 1 step to the form step.
To use the data created by Create or Copy Data in the form, select the form and click the Show Mapping Editor link.
Map the Create or Copy Data output of Computer to the field on the form listing all hardware types, then click OK to save the mapping and close the Mapping Editor.
To complete the flow, connect the rest of the outcome paths.
Save the flow, and run it in the Debugger.
Note that in Decisions version 3.5 and above, you’ll need to click on Test Flow to access the Debugger.
The Display Hardware Form opens, and we can select from the computers we added.
Error Message Example
Another application of Create or Copy Data component is to set a true/false flag for whether to display a custom error message in a form. A visibility rule in the form could look for this flag and know when to show an error message.
In the beginning of the flow, the Create or Copy Data step (renamed Show Error – False) is configured to create a single piece of data of Boolean data type, and a constant value of False. Based on the data input in the form, a rule determines whether proper criteria is met. If the output is false, the flow is directed to another Create or Copy Data step (renamed Show Error – True) which is configured to create a single piece of data of Boolean data type, and a constant value of True.
The form has a visibility rule to evaluate the value of the error flag. When the form first runs, the flag is set to false and therefore the error message does not appear. When the form visibility rule evaluates the error indicator as true, however, the custom error message does display to the user.