Soft Delete with Approval Gate
User triggers a delete request via a form. Flow sends an approval first, and only deletes the SQL row if approved. Demonstrates Delete Row with a safety gate.
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 - Soft Delete with Approval Gate demonstrates a safe delete pattern with human-in-the-loop governance. A user submits a record ID via Microsoft Forms, the flow retrieves the full record from SQL Server, sends an approval request with record details, and only deletes the row if approved. This is a key governance pattern for any organization that needs audit-controlled data deletion.
Use Case
Organizations often need to allow users to request record deletions while maintaining oversight. This flow ensures no SQL row is deleted without explicit managerial approval, providing an auditable safety gate between the request and the destructive action. Ideal for compliance-sensitive environments (GDPR, SOX, HIPAA) where delete operations must be traceable.
Flow Architecture
When a New Response Is Submitted
Forms WebhookFires when a user submits the delete request form.
Get Response Details
Forms - GetFormResponseByIdRetrieves the full form response including the Record ID. Runs in parallel with the variable initializations.
Init varSqlServerName
Initialize VariableSQL Server hostname loaded from the flowlibs_SqlServerName environment variable.
Init varSqlDatabaseName
Initialize VariableSQL database name loaded from the flowlibs_SqlDatabaseName environment variable.
Init varTableName
Initialize VariableTarget table name loaded from the flowlibs_SqlTableName environment variable.
Init varApproverEmail
Initialize VariableApprover email loaded from the flowlibs_SoftDeleteApproverEmail environment variable.
Init varRecordIdQuestionId
Initialize VariableForms question ID for the Record ID field, loaded from flowlibs_SoftDeleteRecordIdQuestionId.
Compose Extract RecordId
ComposeExtracts the Record ID value from the form response body using the question ID variable as a dynamic key.
Get Record To Delete
SQL Server - GetItem_V2Fetches the full record by primary key so the approver can see exactly what will be deleted.
Compose Record Details HTML
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_SqlServerName | String | your-server.database.windows.net | Hostname of the SQL Server that holds the table you want to delete from. |
| flowlibs_SqlDatabaseName | String | FlowLibsDemoDB | Name of the target database. |
| flowlibs_SqlTableName | String | [dbo].[FormSubmissions] | Fully-qualified table name containing the records that may be deleted. |
| flowlibs_ApprovalAssignedToEmail | String | approver@yourcompany.com | Generic approver email used by other FlowLibs flows; also referenced here as a fallback. |
| flowlibs_SoftDeleteFormId | String | <configure> | Microsoft Forms form ID for the delete-request form. Copy from the form URL after creating it. |
| flowlibs_SoftDeleteApproverEmail | String | approver@yourcompany.com | Configurable approver email specific to this flow. Overrides flowlibs_ApprovalAssignedToEmail when set. |
| flowlibs_SoftDeleteRecordIdQuestionId | String | <configure> | Forms question ID for the Record ID field. Inspect a sample form response JSON to find it. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Microsoft Forms | shared_microsoftforms | CreateFormWebhook (trigger) GetFormResponseById |
| SQL Server | shared_sql | GetItem_V2 DeleteItem_V2 |
| Approvals | shared_approvals | StartAndWaitForAnApproval (Basic approval) |
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.
- Create the delete-request Microsoft Form
- Build a Microsoft Form with a single text question 'Record ID'. Copy the Form ID from the form URL into flowlibs_SoftDeleteFormId, and copy the question ID (visible in the form response JSON) into flowlibs_SoftDeleteRecordIdQuestionId.
- Point the flow at your SQL table
- Update flowlibs_SqlServerName, flowlibs_SqlDatabaseName, and flowlibs_SqlTableName to the server, database, and table you want this approval gate to protect.
- Configure the approver
- Set flowlibs_SoftDeleteApproverEmail (or flowlibs_ApprovalAssignedToEmail) to the person who should approve deletions for this flow.
- Authorize connections
- Open the flow in the designer and authorize the SQL Server, Microsoft Forms, and Approvals connection references with accounts that have the necessary permissions.
- Turn the flow on
- Change the flow state from Off to On after the connections are valid and the env vars are populated.
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.01Extract Record ID from form response
Uses the question-ID variable as a dynamic key on the form response body to pull the user-supplied Record ID.
EXPR.02Approval outcome check
Used in the If condition to branch on whether the approver clicked Approve.
EXPR.03Submitter identity with anonymous fallback
Falls back to 'Anonymous' when the form allows unauthenticated submissions and no responder is captured.
EXPR.04Record serialization for display
Serializes the SQL record body to a string so it can be embedded inside the HTML approval message.
EXPR.05Approval title
Builds a descriptive approval title that identifies both the record and the table at a glance.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.