Wait On External System
  • 07 Jun 2022
  • 6 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Wait On External System

  • Dark
    Light

Article summary

Overview

This tutorial demonstrates how to use the Wait On External System step in Decisions. This step is an Assigned Form for the External System (Service, External Database, etc.). This step monitors the External System, and when the desired condition is met, continues Flow execution on the Defined Outcome Path.

Example

In this example, use the Wait On External System step to monitor an External Database (Customers table in Northwind database). If a new Customer is added to the table, the Flow will stop monitoring External Table, send an email to notify that a new Customer was added to the table, and start monitoring Customers Table again.

This example assumes the Northwind database has been integrated with the Portal. The default Decisions database or integration with another database may be used. For more information on integrating a database, see Integrating an External Database with a Flow.

2019-06-26_1515.png

Next, navigate to the Designer Folder and select Create Flow on the Folder Actions Panel.

2019-06-26_1516.png

In the resulting window name the Flow and select 'Create' to proceed to the Flow Designer.

2019-06-26_1517.png

In the Flow Designer, add Get all from dbo.Customers step from Integrations > My Integrations > Database > Northwind (Database) > dbo.Customers (Table) category.

2019-06-26_1520.png

Then, connect the Failed outcome from Get all from dbo.Customers step to the End step in the Flow. Set Limit Count Inputs to Ignore.

2019-06-26_1521.png

On the Done outcome from the Get all from dbo.Customers step add Wait On External System step from Integrations > All Integrations category.

2019-06-26_1522.png

Next, set up the Wait On External System step. Configure Service Definition Settings. Leave the Generate Service check-box unchecked.

Then, select Add New link to Expose Data On Service for the Wait On External step to be able to operate with data from the Flow.

2019-06-26_1523.png

In the resulting window name the Data and pick Type. In this example expose Results from the Get all from dbo.Customers step, therefore pick Northwind_dboCustomers type and check Is List and Can Be Null check-boxes. Select 'Ok' to save and continue.

2019-06-26_1528.png

Wait On External System step has a similar behavior as an External Form. By selecting the View Integration Details link there is information on how to integrate with this Service.

2019-06-26_1531.png

2019-06-26_1532.png

Then, set up Timer Settings. First, select Add New under Scenarios [Additional Outcomes for AutoComplete] . Each of these Scenarios will be an End step in the AutoComplete Flow for this step.

2019-06-26_1535.png

In the resulting window name the Scenario.

2019-06-26_1536 .png

Next, select Add New under Parameters. These Parameters are going to be AutoComplete Flow Outcome Data from this Scenario (Outcome Path). Name the Parameter and define its Type as Northwind_dboCustomers. This will be a single Customer that will be added to the Customer database. This will be used later in the main Flow. When finished select 'Ok' to save and close this window.

2019-06-26_1537.png

2019-06-26_1538.png

Back to Wait On External System settings, define Check Time Span. This Time Span will be used by the step to monitor the External System. In this example set it to check every 15 seconds.

2019-06-26_1539.png

Note on Check Time Span 
Setting Check Time Span to any time below 5 seconds is not recommended as it may affect system performance depending on the overall system load. Establishing this will trigger a warning message and highlight the Check Time Span settings in yellow. 

Next, in the Inputs Section for the Customers Input Select Value of the Customers_Result from Get all from dbo.Customers step.

2019-06-26_1541.png

Finally, select the 'Edit' icon for Is Complete Flow. This Flow will monitor the External System and evaluating which outcome path the Flow should take.

2019-06-26_1542.png

Is Complete Flow opens in the Flow Designer. The Flow has two End steps. Step Not Complete (Default) and CustomerAdded (defined by us as Outcome Scenario previously in this tutorial). Build this Flow to check if a new record is added to the database and if it is, proceed on CustomerAdded outcome, and if not proceed to Step Not Complete outcome.

2019-06-26_1555.png

After Start step in the Flow add Get all from dbo.Customers step from Integrations > My Integrations > Database > Northwind (Database) > dbo.Customers (Table) category.

2019-06-26_1556.png

Then, connect the Failed outcome to the Step Not Complete End step. On the Done outcome add Greater Than Rule step from All Steps [Catalog] > Data > Numbers category.

2019-06-26_1601.png

Then, select Get all from dbo.Customers step on the work-space and set it up as follows. Ignore Limit Count input and change Output Variable Name and Custoners_Result output Name.

2019-06-26_1621.png

Then, select Greater Than step on the work-space and select Show Mapping Editor.

2019-06-26_1622.png

In the Mapping Editor map Customer_Result New.Count (Get all from dbo.Customers in this Flow) to value1 and Customers_Result.Count (Flow input from the Main Flow) to value2. When finished save and close Mapping Editor.

2019-06-26_1624.png

Next, connect False outcome from Greater Than Rule to the Step Not Complete End step. On the True outcome, add ForEach Step from Flow Management category.

2019-06-26_1625.png

In the resulting window, select Pick the option Customers_Result_New as Select Value [From Flow] for ForEach step and Data type.

2019-06-26_1627.png

Then, on the Next outcome from the ForEach step add String is Not in List step from the All Steps [Catalog] >Data > Text category.

2019-06-26_1628.png

Next, select Show Mapping Editor for String is Not in List step.

2019-06-26_1629.png

In the Mapping Editor use CustomerID list from Customers_Result(Flow input) as a list value and Item.CustomerID as a value to check. When finished save and close Mapping Editor.

2019-06-26_1638.png

Then, on the True outcome from String is Not in List step add Create Data step from the Favorite Steps category.

2019-06-26_1639.png

For the Create Data step Add New Data Definition to be a Customer of Type Northwind_dboCustomers. Then, select 'Ok' to save and continue.

2019-06-26_1641.png

2019-06-26_1642.png

Next, for the Customer Input to the Create Data step Select Value of the Item outcome from the ForEach step.

2019-06-26_1643.png

Connect Done outcome from Create Data step to CustomerAdded End step in the Flow. Then, Select Value of Customer output from Create Data step to be an Output on the CustomerAdded End step in the Workflow.

2019-06-26_1647.png

2019-06-26_1652.png

Connect the rest of the Outcome Paths from the steps as following:

  • False outcome from Greater Than step to Step Not Complete End step
  • False outcome from String is Not in List step to ForEach step
  • Done outcome from the ForEach step to CustomerAdded End step.

This completes the Is Complete Flow. Save it and close the Flow Designer.

2019-06-26_1656.png

Back to the Main Flow add Send Email step from Favorite Steps category on CustomerAdded outcome from Wait On External System step.

2019-06-27_1345.png

Then, select Show Mapping Editor option for Send Email step.

2019-06-27_1346 .png

In the Mapping Editor define Constant From Email Address, To Email Address, and Subject. For Email Body use Text Merge.Plain Mapping type and select Show Editor.

2019-06-27_1349 .png

In the Text Merge Editor use Customer Properties to compose Email Body Notification. When finished select 'Ok' to save and continue. Then, save and close Mapping Editor.

2019-06-27_1356.png

Back in the Flow Designer connect sent outcome from Send Email step back to Get all from dbo. Customers step (to continue monitoring the External Database). Failed outcome from Get all from dbo. Customers step goes to the End Step in the Flow.

This completes the Flow; select Debug on the top panel of the Flow Designer to test.

2019-06-27_1359.png

Flow starts in the Debugger and stops on Wait On External System step. At this point start to monitor the External Database and wait until the new Customer is Added.

2019-06-27_1400.png

Go to the External Database and add a new record to the Customers Database.

Back in the Flow Debugger, the Wait On External System step detects that new Customer was added to the Database and continues Flow Execution.

An Email is received notifying us that a New Customer was Added. The Flow execution goes back to Get all from dbo.Customers step and Waits On External System again.

Repeat the process as many times as needed to confirm the Wait on External System step and its Flow function as intended.


Was this article helpful?