Use Flow Steps to Integrate with an External Database

Last Updated: 10/10/2018 Introduced in Version:

After an External Database has been created and integrated into Decisions, use specific Flow Steps to integrate the external data into the flow. When integrating with a Database in Decisions use Flow Steps to Update, Delete and Insert Steps that interact with the integrated Database in the Flow. Display data from an integrated database using a Data Grid component on the Form.




External Database Flow Steps

Create a Flow and use the Insert, Update and Delete Steps against the Database we just integrated with. We navigate to the designer folder and select the Create Flow button from the Folder Actions Panel. Name the Flow (Insert Update Delete Steps Flow), and select Create to proceed to the Flow Designer.

In the Flow Designer we expand Integrations > My Integrations > Database > [Integrated Db Name](Database) > [integrated table name] category. Here we can find all steps to interact with the integrated Database. First, we add Delete [table name] Step (Figure 1). 

Figure 1



Then, connect Failed outcome from the Delete Step to the End step in our Flow. Select the Delete step in the flow designer and locate the step properties (Figure 9). The record that will be deleted with this step should be identified by the Primary Key ID from the table (in this case UnitID is a primary key in the integrated table). For the UnitID we select Constant Mapping type and provide desirable Value. Then, we click Add Step (Figure 2).

Figure 2



Now add an Insert to [table name] step from Integrations > My Integrations > Database > [Integrated Db Name](Database) > Insert to dbo.zipCodes [integrated table name] (Figure 10). Connect the Deleted Outcome pathway  from Delete step (Figure 3).

Figure 3




In the same manner, as we did with the Delete step, get the Failed outcome Step from the Insert Step and connect it to the End step.  Select the Insert step in the Flow designer and set the properties of the step. Select Edit Input Mapping (Figure 4).

Figure 4



This step is able to insert an Array of records into the table. In the properties tab under Inputs, select the Build Array option for Inserted Objects (Figure 12). Then for the first record (Item 0) in the Array select Build Data, and create a Record by filling in each field with Constant Values (Figure 5).

Figure 5



Back in the Flow designer we add Update [table name] step from the Integrations > My Integrations > Database > [Integrated Db Name](Database) > Update dbo.zipCodes [integrated table name] on the Inserted Outcome from Insert step (Figure 6).

Figure 6



Again, connect the Failed outcome from the Update Step to the End Step in the Flow. Edit the Step properties tab (Figure 7).

Figure 7



Update step is very similar to Insert step. Under Inputs configure data for this step in the exact same manner as we did for the Insert step (Figure 8). 

Figure 8




To display data from the table we need to query it first. In order to obtain data from the table first add a Get all from [table name] Step tab the flow. In the Steps tab locate Integrations > My Integrations > Database > [Integrated Db Name](Database) > Get all from dbo.zipCodes [integrated table name] , and connect the Updated Outcome pathway to the step (Figure 9).

Figure 9



We connect Failed outcome from Get all from [table name] step to the End step in the Flow, and edit the step properties. This step does not require specific Input configuration. The only input that is configured is Limit of Records. In this case, we just ignore this Input (Figure 10). Mention, the data type that is being returned from this step. We will use this data type for the Data Grid in the next step, which will be a Form

Figure 10


Select Add Step to add the final step to the Done outcome from Get All step. Create a Form to display all records from the table in the Grid. Add Show Form step from Favorite Steps category and provide this step with a Name (figure 11).

Figure 11



In the resulting window Name the Form and click Create to proceed to the Form Designer. Each Form should have at least one outcome. We add Button component from the Actions category in the ToolBox to our Form. Then, name the text on the Button to “Done”.  Use a Data Grid component to Display data from our table. Locate Data Grid in the components under Favorites (Figure 12).

Figure 12



Next, we need to configure our Data Grid component. In order to display data from our integrated table, we need to configure Data Grid component to accept the appropriate Type. In this case, Type should match Data Type that is coming out of the Get All step (dbo.ZipCodes). Locate this Type in the Table Definition Types category using Type picker (Figure 13).

Figure 13



After the Data Grids properties are defined with a name and the dataType, define the columns that will be displayed on the grid, under column information. Under Output Data select the output mode, for this example the InfoOnly mode will be selected from the drop-down selection (Figure 14).  

Figure 14



Moreover, we can add Row actions and Row Links to the Data Grid component (Figure 15). When we finished with Data Grid component, we can Save and Close Form Designer to return back to the Flow Designer.

Figure 15



In the Flow designer we connect the Outcome from our Form to the End Step. Then, we click on the Form Step and select Show Mapping Editor option (Figure 16).

Figure 16




In the Mapping Editor we map outcome data from the Get all step to the Data Grid component Name in our Form. Then, click Ok to close Mapping Editor (Figure 17).

Figure 17



This completes our Flow. To test it we click Debug Flow link on the top panel of the Flow Designer (Figure 18).

Figure 18



Our Flow runs in the Debugger and first thing that we see is our Form. Behind the scenes our Flow does all work as we designed. Our Form displays the records from our database table with changes that were done by our Flow (Figure 19).

Figure 19




Debugger indicates that our Flow ran with no errors (Figure 20).

Figure 20




Look at the original database to onfirm that the Flow did design changes to the table. This completes this Flow example using Insert, Update and Delete steps.




Additional Resources