Send SQL Statement

Use this step to send a SQL query to a tenant database.

Last published at: September 10th, 2025

clsSendSQLToTenantDB Step

Description:

The Send SQL Statement workflow step belongs to the Tenants category in FlowWright. Its internal name is clssendsqltotenantdb, its label is Send SQL Statement to tenant database, and its display name is Send SQL Statement. The step uses the FlowWright.Workflow.ClsSendSQLToTenantDB namespace and FlowWright.Workflow.dll. It is defined as a Process step with two input connections and two output connections.

The Send SQL Statement step uses a configured Tenant Manager connection, a tenant name or ID, and a list of SQL statements to send to the selected tenant database. All three properties are required.

The step supports:

  • Selecting a Tenant Manager connection
  • Identifying a tenant by name or ID
  • Supplying a list of SQL statements
  • Executing tenant-database SQL operations as part of a workflow
  • True/False workflow branching 

This step can be useful for:

  • Tenant database initialization
  • Tenant-specific database configuration
  • Controlled database maintenance
  • Tenant provisioning workflows
  • Applying tenant-specific database changes
  • Executing a sequence of SQL statements against a tenant database
  • Automating tenant database administration

 

Inputs

  • Select Tenant Manager connection – Selects the Tenant Manager connection used for the tenant-database operation.
  • Tenant name or ID – Identifies the tenant whose database will receive the SQL statement(s).
  • List of SQL strings – Provides the list of SQL statements to be sent to the tenant database.
 

 

Returns

  • True – Step executed successfully
  • False – Step failed to execute
 

 

Usage:

The Send SQL Statement step is typically placed in a workflow after the target tenant has been identified and the required SQL statements have been prepared.

The workflow can dynamically build or obtain the tenant and SQL inputs using:

  • Workflow Variables
  • Global variables
  • Form values
  • Previous workflow outputs
  • Tenant-management information
  • Files generated or obtained by previous workflow steps
  • Data retrieved from external systems

 

Typical Workflow Suggestions.

  • Tenant Database Initialization. The step can be used after a tenant is created to perform required database initialization. This is useful when tenant-specific database setup is part of a larger provisioning workflow.
  • Tenant Provisioning. Use the step as part of a tenant provisioning process. The SQL input can be prepared before the step and supplied through its required List of SQL string property.
  • Apply Tenant-Specific Database Changes. The step can be placed in a workflow that needs to apply a controlled SQL change to one tenant. This pattern provides an explicit approval point before performing the database operation.
  • Execute a List of SQL Statements. Because the step exposes a List of SQL string inputs, it can be used when the workflow needs to supply a collection of SQL statements rather than a single SQL statement. The exact handling of multiple statements should be validated against the FlowWright runtime implementation, as the XML does not specify execution order or transaction behavior.
  • Tenant Database Maintenance. The step can be incorporated into controlled tenant database maintenance workflows. This provides a workflow-controlled mechanism for applying approved tenant-specific SQL operations.
  • Handle SQL Execution Failure. Use the False path to ensure that the workflow does not proceed as though the operation succeeded. The True and False paths are explicitly defined by the step.
  • Tenant-Specific Configuration. The step can be used when tenant configuration requires database-level changes. This is particularly useful when the configuration operation is already represented as an approved SQL script.

 

Example:

Let’s build and execute the “clsSendSQLToTenantDef” example.                 

  • Create a new definition named “SendSQLToTenantDef” and open it in designer mode. 
  • Drag a "clsSendSQLtoTenantDB" step to the canvas.
  • Connect the dots between the “Start” step and "clsSendSQLtoTenantDB" steps, as shown above.
  • Click the "clsSendSQLtoTenantDB" step to configure its "Required" properties. Provide a name for the step. Select the connection string. Enter the Tenant Name or GUID value. Click the button to enter the SQL string. Click the Save button. Note: Click the "AI Predict" button to have Copilot add new process steps that match your process description. 

 

  • Provide the SQL string and click "Add Row" to add more. A pop-up window appears for configuration. Click the Add Row (+) button to insert an empty row. Enter the SQL SELECT syntax. Click the Save button. You may add multiple SQL strings using the Add Row button.  

 

  • The “Logging” configuration is necessary for documentation and also measures workflow progress and percent complete. This is achieved by configuring the step state and percent fields individually, as shown below. Configure the “Logging” using the following properties.

 

  • Save the Process Definition. Create a new Process Instance and execute it. When the workflow reaches the Send SQL Statement step, the configured Tenant Manager connection, tenant name/ID, and SQL statement list are supplied to the step. The workflow then follows the True-or-False execution path.

 

Tips:

  • Select the correct Tenant Manager connection.
  • Verify the Tenant name or ID before executing the operation.
  • Review SQL statements before allowing them to execute against a tenant database.
  • Use an approval stage for production database changes where appropriate.
  • Keep SQL scripts specific to the intended tenant and operation.
  • Test SQL statements against a non-production tenant before production execution.
  • Use the False path to explicitly handle unsuccessful execution.
  • Avoid placing sensitive data directly into workflow log messages.
  • Keep database-change workflows clearly documented and auditable.
  • Maintain appropriate backups or recovery procedures before destructive database operations.
  • Do not assume transaction or rollback support unless it has been verified for the actual implementation.
  • Do not assume that SELECT results are returned to workflow variables; the supplied XML does not define an output property for SQL results.
  • Verify the SQL dialect and supported statement types in the target FlowWright environment before deployment.
  • When using a SQL file/list, ensure that the mapped input contains the intended SQL content before execution.

 

Notes:

  • Category: Tenants. 
  • Internal name: clssendsqltotenantdb
  • Label: Send sql statement to tenant database. 
  • Display name: Send SQL Statement. 
  • Namespace: FlowWright.Workflow.ClsSendSQLToTenantDB
  • DLL: FlowWright.Workflow.dll
  • Step definition type: Process. 
  • Input connections: 2. 
  • Output connections: 2. 
  • Tenant Manager connection: Required. 
  • Tenant name or ID: Required. 
  • List of SQL string: Required. 
  • SQL input type: FileList
  • Returns: True and False.

 

Definition Sample:

You may download the sample definition(s) from the link provided and later import them into the FlowWright Process Definition (XML file) or Form Definition (HTML file) page.

Note: Verify and complete any missing configuration after importing the sample, including:

  • Tenant Manager connection
  • Tenant name or ID
  • SQL statement/file list
  • Variable mappings, if applicable
  • Environment-specific settings
  • Workflow connections

After verifying the configuration, save the Process Definition before execution.

Click here to download the sample file.