Error Handling, Logging and Audit Trails

In the highly regulated UK financial services sector, automating processes brings significant efficiency, but it also introduces risk. If a cloud flow fails silently, a critical compliance check might be missed, a suspicious transaction might go uninvestigated, or a customer might suffer a poor outcome. Under the Financial Conduct Authority requirements for operational resilience and the Consumer Duty (The UK Financial Conduct Authority (FCA) regulatory standard requiring firms to act to deliver demonstrably good outcomes for retail customers across products and support.), firms must ensure their automated systems are robust, predictable and closely monitored. This lesson explains how to build resilient cloud flows in Power Automate using dedicated error capturing, ensuring that when things go wrong, they fail safely and leave a clear audit trail.

Refresher Core Mental Model: Error Handling, Logging and Audit Trails 1 min

In Power Platform Automation for Regulated Teams: Power Automate, Power Apps and AI Builder with Governance, Error Handling, Logging and Audit Trails focuses on turning The Regulatory Context for Resilient Automation into a repeatable, governed practice. Rather than treating tools as black-box oracles, anchor every step to three questions: What approved data goes in? What structured draft comes out? And who verifies the result against primary evidence before action is taken?

The Regulatory Context for Resilient Automation

When you replace a manual process with an automated cloud flow, the accountability does not transfer to the technology. The Senior Managers and Certification Regime (The UK financial regulatory framework establishing personal, non-delegable accountability for senior managers over the operational processes and automations in their area.) expects clear individual accountability, so a named human owner should always remain accountable for the process and its outcomes. This human ownership requires visibility. If an automated workflow encounters an error, such as a time out when connecting to an external database, the accountable owner needs to know immediately. Furthermore, record-keeping requirements mean that the significant actions taken by an automated system, whether successful or failed, should be logged in proportion to their risk.

Error Handling, Logging and Audit Trails

Simultaneously, UK GDPR (Data protection legislation requiring lawful processing, data minimization, purpose limitation, and strict security controls over personal data.) and data protection rules dictate that these logs must be secure. If a flow fails while processing sensitive customer financial data, the resulting error log must not broadcast that confidential data in a plain text email to a shared inbox. Instead, error handling must protect personal data by logging only the necessary system identifiers and error codes, applying least-privilege permissions so that only authorised personnel can view the audit trail.

Understanding Configure Run After Logic

By default, a step in a Power Automate (Microsoft’s workflow orchestration service used to build automated cloud flows, multi-stage approvals, and system integrations under tenant DLP policies.) cloud flow only runs if the previous step completes successfully. If a step fails, the flow stops, and all subsequent steps are skipped. While this prevents the flow from continuing with missing data, it also prevents you from taking automated action to log the failure. To build resilient flows, you must use a feature called configure run after.

This setting allows you to dictate exactly when a specific action should execute based on the outcome of the preceding action. You can configure an action to run in any combination of four scenarios.

  • Is successful: The default behaviour, running only if the previous action completed without issue.
  • Has failed: The action runs if the previous action encountered an error, allowing you to trigger a remediation or logging step.
  • Is skipped: The action runs if the previous action was skipped, for example because an earlier action failed or because it sat in a branch of a condition that was not taken.
  • Has timed out: The action runs if the previous action took too long to respond, which is vital for handling unstable connections to legacy systems.

Structuring Flows with the Try, Catch and Finally Pattern

Applying configure run after logic to every single action in a large flow is inefficient and difficult to maintain. Instead, best practice dictates using the Scope action. A Scope is a structural container that groups multiple actions together. By grouping actions into Scopes, you can apply your configure run after logic to the entire group, creating a professional error handling structure known as Try, Catch and Finally.

Standard Error Handling Scope Blocks
Scope NameConfigure Run After SettingPurpose and Function
Try BlockDefault (Is successful)Contains the main business logic and actions of your flow. If any action inside this block fails, the entire Scope is marked as failed.
Catch BlockHas failed, Has timed out (after Try Block)Contains actions to handle errors. It captures the failure from the Try block, logs the error securely, and alerts the named human owner.
Finally BlockIs successful, Has failed, Is skipped, Has timed out (after Catch Block)Contains actions that must run regardless of success or failure, such as closing connections, updating a run log, or resetting variables.
Plain-text version
Scope Name | Configure Run After Setting | Purpose and Function
Try Block | Default (Is successful) | Contains the main business logic and actions of your flow. If any action inside this block fails, the entire Scope is marked as failed.
Catch Block | Has failed, Has timed out (after Try Block) | Contains actions to handle errors. It captures the failure from the Try block, logs the error securely, and alerts the named human owner.
Finally Block | Is successful, Has failed, Is skipped, Has timed out (after Catch Block) | Contains actions that must run regardless of success or failure, such as closing connections, updating a run log, or resetting variables.

Worked Example: Transaction Monitoring Audit Trail

Consider a transaction monitoring workflow used by a financial crime team. The business requirement is to automatically route alerts for suspicious synthetic transactions to the correct investigator based on risk thresholds. This process handles sensitive information and is subject to strict audit. We will use entirely synthetic data (Artificially created test records that mirror production data structure without containing any real customer PII or confidential business information.) for this example, representing fictitious transactions with no real customer details.

You must enforce testing before release. You will build this flow in a dedicated development environment, as part of your application lifecycle management strategy. Only after rigorous testing with synthetic data will the flow be packaged into a Solution and promoted to the production environment.

In your development environment, you create the Try block. Inside this Scope, the flow reads a new synthetic transaction alert from a secure system. It checks the synthetic risk score against your policy thresholds. If the score is high, it uses an approval action to route the synthetic alert to a designated analyst. All the connections used by this flow are configured with least-privilege permissions, meaning the flow can only read from the alert system and cannot modify or delete source records.

Next, you add the Catch block. You add a new Scope action immediately below the Try block. You edit the configure run after settings for the Catch block, unchecking is successful and checking has failed and has timed out. Inside this Catch block, you need to capture the exact error.

To ensure comprehensive logging and audit, you configure the Catch block to write a record to a dedicated Audit Logs table in Dataverse. You must protect confidential and personal data here. Instead of dumping the entire transaction payload into the error log, the flow writes only the synthetic transaction ID, the flow run ID, the timestamp, and the generic error code. This ensures that if the flow fails because a database is offline, no personal data is inadvertently stored in the audit logs. The named human owner of the flow is then sent an automated notification via a secure Teams channel, alerting them that an error occurred for a specific transaction ID, prompting them to review the secure log.

Finally, you add the Finally block. This Scope is set to run regardless of whether the Catch block ran or was skipped. Inside, it updates a master control tracker to record that the flow execution finished, maintaining a strict record-keeping trail of all automated attempts.

Secure and Compliant Logging Practices

Capturing the error is only half of the governance requirement. Where and how you store those logs is equally critical. Storing audit trails in unstructured formats, such as Excel files on a personal OneDrive, creates shadow IT and undermines your firm’s data protection controls. It also makes it impossible to enforce robust access controls.

Instead, logs and audit trails should be stored in secure, enterprise-grade repositories such as a Dataverse table in a managed environment or a tightly controlled SharePoint list. By using Dataverse, you can apply role based access control. You can give the service account or service principal that runs the cloud flow a security role with Create and Read permission on the log table but no Write or Delete permission, so it can add new error logs but cannot alter or delete historical ones. Note that the Dataverse privilege called Append does not mean append-only; it controls whether records can be linked to other records. Meanwhile, the human supervisors are granted read only access to the audit table, ensuring the integrity of the record-keeping process.

Human Ownership, Handover and Lifecycle Management

Resilient automation requires a clear operational handover. When you build a flow with complex error handling, your Centre of Excellence team must have visibility of the solution, for example through the admin center Inventory and your asset register. The named human owner must understand how to interpret the logs generated by the Catch block. If a flow begins to fail repeatedly due to an external system timeout, the human owner is accountable for pausing the automation, investigating the root cause, and ensuring that no synthetic or real transactions fall through the cracks.

Before any flow goes live, the error handling paths must be explicitly tested. During the testing phase in your non production environment, you should deliberately force errors, for example, by providing an invalid synthetic transaction ID or temporarily removing a permission. This proves that the configure run after logic works, that the Catch block successfully intercepts the failure, that the audit trail is written correctly, and that no confidential data leaks into the error logs. By combining strict architectural patterns, least-privilege permissions and clear human accountability, you can automate complex regulatory workflows safely and securely.

Error Handling, Logging and Audit Trails in practice
Go deeper Architectural & Governance Trade-Offs in Error Handling, Logging and Audit Trails 1 min · optional

When scaling Understanding Configure Run After Logic across a team or regulated workflow, the primary bottleneck is rarely generation speed—it is verification overhead and drift. High-performing teams track two operational metrics alongside throughput: Edit-to-Approval Time (how many minutes a human reviewer spends correcting outputs) and Source-Traceability Rate (whether 100% of material numbers and claims link back to an audited record). If edit time exceeds manual drafting baseline across two cycles, tighten your input schema and negative constraints before expanding scope.

Custom Enterprise Workshop • The Tesseract Academy

In-House Corporate AI Strategy & Governance Clinics

Bespoke executive clinics led by Dr. Stylianos Kampakis for leadership teams, boards, and division directors.