Approved Record Deletion Workflow
User submits a Salesforce record deletion request; on manager approval the flow deletes the record and posts a confirmation to Teams, or notifies the requestor on rejection.
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
The Approved Record Deletion Workflow is a governance-focused flow that ensures Salesforce records are never deleted without explicit manager approval. A user triggers the flow manually, providing the Record ID and a deletion reason. The flow fetches the record details from Salesforce, presents them in a styled approval request, and routes to the configured approver. On approval, the record is permanently deleted and a confirmation is posted to Teams. On rejection, the team is notified with the reviewer's comments.
Use Case
Organizations need controlled deletion of Salesforce records (Accounts, Contacts, Opportunities, Cases) to prevent accidental data loss and maintain audit trails. This flow enforces a human-in-the-loop approval gate before any destructive operation, with full visibility via Teams notifications. It supports any Salesforce object type through a configurable environment variable.
Flow Architecture
Manually trigger a flow
Manual button triggerButton trigger with two required text inputs: Record_ID (Salesforce record ID) and Deletion_Reason (justification text).
Initialize variables (4x parallel)
Initialize variableFour parallel Initialize Variable actions load environment variable values into flow variables: varTeamsGroupId from flowlibs_TeamsGroupId, varTeamsChannelId from flowlibs_TeamsChannelId, varApproverEmail from flowlibs_ApprovalAssignedToEmail, and varSalesforceObjectType from flowlibs_SalesforceObjectType.
Get Record Details
Salesforce - Get itemFetches the full Salesforce record using the dynamic object type (from varSalesforceObjectType) and the provided Record ID.
Compose Record Summary
ComposeBuilds a styled HTML summary card with a red gradient header and a 5-row data table (Record ID, Object Type, Record Name, Deletion Reason, Requested At) to include in the approval request.
Request Deletion Approval
Approvals - Start and wait for an approvalSends a Basic-type approval with the styled summary to the configured approver (varApproverEmail) and waits for the response.
Check Approval Outcome
If conditionEvaluates body('Request_Deletion_Approval')?['outcome'] equals 'Approve'.
- Salesforce - Delete record — Permanently deletes the Salesforce record matching Record_ID and the configured object type.
- Teams - Post message in a chat or channel — Posts a green confirmation card to the configured Teams channel with record details, approver info, and a timestamp.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TeamsGroupId | String | <configure> | Microsoft Teams Group (Team) ID for posting approval/rejection notifications. |
| flowlibs_TeamsChannelId | String | <configure> | Microsoft Teams Channel ID (within the Team above) where notifications are posted. |
| flowlibs_ApprovalAssignedToEmail | String | approver@contoso.com | Email address of the approval reviewer/manager who will receive the deletion approval request. |
| flowlibs_SalesforceObjectType | String | Account | Salesforce object type to query and delete (e.g., Account, Contact, Opportunity, Case). |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Salesforce | shared_salesforce | GetItem (fetch record) DeleteRecord (remove record on approval) |
| Approvals | shared_approvals | StartAndWaitForAnApproval (Basic type approval gate) |
| Microsoft Teams | shared_teams | PostMessageToConversation (approval/rejection notifications) |
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.
- Change the target Salesforce object
- Update the flowlibs_SalesforceObjectType env var value (e.g., Contact, Opportunity, Case). The flow dynamically uses this for both the lookup and delete operations.
- Change the approver
- Update flowlibs_ApprovalAssignedToEmail to the desired manager or distribution list email.
- Route notifications to a different Teams channel
- Update flowlibs_TeamsGroupId and flowlibs_TeamsChannelId to target a different Team/Channel.
- Add email notification
- Add an Outlook SendEmailV2 action after the Teams posts to also email the requestor about the outcome.
- Add audit logging
- Insert a Dataverse CreateRecord or SharePoint PostItem action before the Teams notification to log every deletion request (approved or rejected) for compliance.
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.01Dynamic record name extraction
Handles different Salesforce objects that use different name fields (Account/Contact use Name, Case uses Subject, etc.).
EXPR.02Approval outcome check
Used in the If condition to branch on whether the approver accepted the deletion request.
EXPR.03Null-safe approver comments
Falls back to a friendly placeholder when the approver leaves the comments field blank.
EXPR.04Approver email extraction
Pulls the responder's email from the approval response for inclusion in the confirmation card.
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.