Order Lookup Teams Bot
A Teams-triggered flow where a user provides an Order ID and gets back the full order details from SQL. Demonstrates Get Row for single-record lookup.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
FlowLibs - Order Lookup Teams Bot is an instant (button-triggered) flow that accepts an Order ID from the user, retrieves the corresponding row from a SQL Server database using the Get Row (V2) connector action, formats the result as a styled HTML table, and posts it to a Microsoft Teams channel. This flow demonstrates the single-record lookup pattern using the SQL Server connector's GetItem_V2 operationId.
Use Case
Sales teams and operations staff frequently need to look up order details quickly without navigating to a database tool or ERP system. This flow provides a self-service lookup — a user triggers the flow, enters an Order ID, and receives the full order record in a Teams channel within seconds.
Flow Architecture
Manually trigger a flow
Request (Button)Accepts a text input "Order ID" from the user.
Initialize varSqlServer
InitializeVariableLoads SQL Server name from `flowlibs_SqlServerName` env var.
Initialize varSqlDatabase
InitializeVariableLoads database name from `flowlibs_SqlDatabaseName` env var.
Initialize varSqlTable
InitializeVariableLoads table name from `flowlibs_SqlTableName` env var.
Initialize varTeamsGroupId
InitializeVariableLoads Teams group ID from `flowlibs_TeamsGroupId` env var.
Initialize varTeamsChannelId
InitializeVariableLoads Teams channel ID from `flowlibs_TeamsChannelId` env var.
Get Order Row from SQL
OpenApiConnection (SQL Server `GetItem_V2`)Retrieves a single row by ID from the configured SQL table. Runs after the SQL-related variable initializations.
Compose Order Details HTML
ComposeFormats the row data into a styled HTML table with the Order ID header.
Post Order Details to Teams
OpenApiConnection (Teams `PostMessageToConversation`)Posts the HTML-formatted order details to the configured Teams channel. Runs after the Teams variable initializations and the Compose action.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SqlServerName | String | your-server.database.windows.net | Target SQL Server hostname. |
| flowlibs_SqlDatabaseName | String | FlowLibsDemoDB | Target database name. |
| flowlibs_SqlTableName | String | [dbo].[FormSubmissions] | Table containing order records. |
| flowlibs_TeamsGroupId | String | <configure> | Microsoft 365 Group ID for the target Teams team. |
| flowlibs_TeamsChannelId | String | <configure> | Channel ID where results are posted. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| SQL Server | shared_sql | GetItem_V2 (single-record lookup by primary key) |
| Microsoft Teams | shared_teams | PostMessageToConversation (posts HTML order details to the configured channel) |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Set your SQL Server connection
- Update the flowlibs_SqlServerName env var to point to your server, and authorize the SQL Server connection reference.
- Point to your Orders table
- Update flowlibs_SqlTableName to your table name (e.g., [dbo].[Orders]). The table must have a primary key column that matches the Order ID input.
- Configure Teams destination
- Set flowlibs_TeamsGroupId and flowlibs_TeamsChannelId to your target Teams team and channel.
- Customize the HTML output
- Edit the "Compose Order Details HTML" action to format specific columns from your table instead of the full record JSON.
- Turn on the flow
- Once connections are authorized and env vars are set, turn on the flow from the flow details page.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Trigger input
Retrieves the Order ID entered by the user.
EXPR.02SQL row output
The full row object returned by GetItem_V2.
EXPR.03Record to string
Serializes the row for display in HTML.
EXPR.04HTML concat
Builds the styled HTML message posted to Teams.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.