Calling Stored Procedure From Flow To Write Data (3.2.0)Last Updated: 07/20/2016 Introduced in Verision: 2.0 |
This tutorial demonstrates how to add Stored Procedures while integrating with Database in Decisions 3.2. Next, we will call Stored Procedure from the Flow to write data to the Database we integrated with.
Example:
For our example we have a simple Database with a Stored Procedure that inserts a new row into the Database.
In the Portal we navigate to the System > Integrations > Databases Folder and click Create Connection from the Folder Actions Panel.
In the resulting window we fill in all required fields for the connection and click Test to test our Connection.
System checks the connection to the database and informs us if it was Successful. And if it was, we can click Ok to Save this connection.
Our connection shows up in Databases Folder under the Name we have provided for it while we were creating the connection. We navigate to DemoDB Folder and click Add Procedure button on the Folder Actions Panel.
In the resulting Add Procedure window we pick available Stored Procedure.
When Procedure Definition is picked, we can see all the Input Parameters for this Procedure. We click Ok to save our Procedure Definition.
Then, we should be able to see our Procedure definition in the DemoDB Folder.
To call this Procedure from the Flow we need to create a Flow. We navigate to the Designer Folder and click Create Flow from the Folder Actions Panel.
Next, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add Exec dbo.InsertSampleDatabaseenCurtis step from the Integrations > My Integrations > Database > DemoDB (Database) category.
Next, we connect both (Failed and Exec) outcomes from this Step to the End Step in our Flow. We select Exec dbo.InsertSampleDatabaseenCurtis step on the workspace and we should be able to see all inputs to the Stored Procedure in the Step Information Layer.
For the simplicity of this example we use Constant Values for all of our required Inputs to this Step.
This completes our Flow. 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 this function.
The Flow runs in the Debugger. Debugger Diagram indicates that our Flow ran with no issues and Exec dbo.InsertSampleDatabaseenCurtis step was executed on the Exec path successfully.
If we check our Table, we can confirm that a new Row was added.