Introduction

As Power Automate flows become more complex, managing errors and troubleshooting failed actions can become challenging.

One of the best ways to organize complex flows is by using Scopes together with Configure Run After.

Scopes allow you to group related actions into a single logical block, while Configure Run After allows you to control when another action or scope should execute based on the previous step's result.

What Is a Scope in Power Automate?

A Scope is a container that allows you to group multiple actions together.

For example, instead of having all actions directly inside a flow:

Code
Get SharePoint Item
Update SharePoint Item
Send Email
Create Log

You can organize them like this:

Code
Scope – TRY
    ↓
Get SharePoint Item
    ↓
Update SharePoint Item
    ↓
Send Email

Scope – CATCH
    ↓
Send Error Notification
    ↓
Create Error Log

This makes the flow easier to understand and maintain.

Example: SharePoint Approval Flow

Imagine you have a flow that processes an invoice approval.

The flow needs to:

  1. Get invoice details.

  2. Update the invoice status.

  3. Update GL coding details.

  4. Send an approval notification.

  5. Log the result.

Instead of creating a flat flow, use separate scopes.

🟢 Scope 1 – TRY

Code
Scope – TRY
│
├── Get Invoice Item
│
├── Get GL Coding Details
│
├── Update Invoice Status
│
├── Update GL Coding Details
│
└── Send Approval Email

All the main business logic is contained inside the TRY scope.

🔴 Scope 2 – CATCH

Create another scope after the TRY scope.

Code
Scope – CATCH
│
├── Get Error Information
│
├── Create Error Log
│
└── Send Error Notification

The important part is configuring the Run After settings.

Configure Run After

Select the CATCH scope and open:

⋯ → Configure run after

You can configure it to run when the TRY scope:

  • ✅ Is successful

  • ❌ Has failed

  • ⏱️ Has timed out

  • ⏭️ Is skipped

For an error-handling scope, typically select:

Code
☐ is successful
☑ has failed
☑ has timed out
☐ is skipped

Now the CATCH scope will execute when the TRY scope fails or times out.

Flow Structure

A production-style flow could look like this:

Code
Trigger
   ↓
Validate Request
   ↓
┌──────────────────────────────┐
│       SCOPE – TRY            │
│                              │
│ Get SharePoint Item          │
│        ↓                     │
│ Update Invoice               │
│        ↓                     │
│ Update GL Coding             │
│        ↓                     │
│ Send Email                   │
└──────────────────────────────┘
              ↓
       Configure Run After
       Failed / Timed Out
              ↓
┌──────────────────────────────┐
│      SCOPE – CATCH           │
│                              │
│ Create Error Log             │
│        ↓                     │
│ Send Error Notification      │
└──────────────────────────────┘
              ↓
┌──────────────────────────────┐
│      SCOPE – FINALLY         │
│                              │
│ Update Execution Status      │
│ Log Completion                │
└──────────────────────────────┘

This pattern is commonly called the Try–Catch–Finally pattern.

Why Use TRY, CATCH and FINALLY?

1. TRY – Business Logic

The TRY scope contains the actual business process.

For example:

Code
Get Invoice
↓
Validate Invoice
↓
Update Invoice
↓
Update GL Coding
↓
Send Notification

If everything succeeds, the flow continues normally.

2. CATCH – Error Handling

The CATCH scope handles exceptions.

For example:

Code
TRY failed
     ↓
CATCH
     ↓
Create Error Log
     ↓
Send Teams/Email Notification

Instead of allowing the flow failure to go unnoticed, you can record exactly what happened.

3. FINALLY – Cleanup / Completion

A FINALLY scope can be used for actions that should happen regardless of whether the TRY scope succeeds or fails.

For example:

Code
FINALLY
↓
Update Execution Status
↓
Set End Time
↓
Store Processing Result

Configure Run After for the FINALLY scope to run after the TRY/CATCH processing as appropriate.

Example: Error Logging

Suppose the Update Invoice action fails.

Without proper error handling, you may only see:

Code
ActionFailed

With a structured error-handling design, you can create an error log containing information such as:

FieldExample
Flow NameInvoice Approval Flow
Invoice ID10245
StepUpdate Invoice
StatusFailed
Error MessageSharePoint item update failed
Execution Start10:30 AM
Execution End10:31 AM

This is especially useful for production troubleshooting.

Scope Naming Best Practice

Use meaningful names instead of generic names such as:

Code
Scope
Scope 2
Scope 3

A better approach is:

Code
SCOPE - TRY
SCOPE - CATCH
SCOPE - FINALLY

For larger flows, you can be even more specific:

Code
SCOPE - TRY - Process Invoice
SCOPE - CATCH - Handle Invoice Error
SCOPE - FINALLY - Update Execution Log

This makes the flow easier for another developer to understand.

Scopes for Large Power Automate Flows

Scopes are particularly useful when your flow contains many actions.

For example:

Code
Trigger
   ↓
Scope - Validation
   ↓
Scope - Get Master Data
   ↓
Scope - Process Invoice
   ↓
Scope - Update SharePoint
   ↓
Scope - Send Notification
   ↓
Scope - Error Handling

Instead of looking at 50–100 individual actions, developers can understand the flow at a higher level.

Scope vs Condition

A Condition is mainly used to make a decision:

Code
Is Invoice Approved?
       ↓
   Yes     No

A Scope is mainly used to organize and group actions:

Code
Scope
├── Get Item
├── Update Item
└── Send Email

They solve different problems and can be used together.

Important Best Practice

Don't put your entire flow inside one huge TRY scope.

For example:

Code
Scope - TRY
├── 100 Actions
├── 100 Actions
├── 100 Actions
└── ...

This can make troubleshooting difficult.

Instead, divide the flow into logical sections:

Code
Scope - Validation
Scope - Get Data
Scope - Processing
Scope - Update
Scope - Notification
Scope - Error Handling

This gives you better visibility and control.

Real-World Example

Consider an Invoice Approval process:

Code
When invoice is submitted
          ↓
     Validate Invoice
          ↓
┌─────────────────────────────┐
│ SCOPE - TRY                 │
│                             │
│ Get Invoice                 │
│ Get Vendor                  │
│ Get GL Coding               │
│ Validate Amount             │
│ Update Invoice              │
│ Update Approval Task        │
│ Send Notification           │
└─────────────────────────────┘
          ↓
┌─────────────────────────────┐
│ SCOPE - CATCH               │
│                             │
│ Create Audit Log             │
│ Store Error Message          │
│ Send Error Notification      │
└─────────────────────────────┘

If the invoice update fails, the CATCH scope can automatically record the failure and notify the support team.

Benefits of Using Scopes

🔹 Better Organization

Related actions are grouped together.

🔹 Easier Troubleshooting

You can quickly identify which scope failed.

🔹 Better Error Handling

Configure Run After lets you build controlled error-handling paths.

🔹 Easier Maintenance

Developers can understand the flow structure faster.

🔹 Production Reliability

Errors can be logged and communicated instead of silently failing.

For complex production flows, consider this structure:

Code
Trigger
   ↓
Validation
   ↓
TRY
   ↓
Business Processing
   ↓
CATCH
   ↓
Error Logging
   ↓
FINALLY
   ↓
Execution Logging

You can combine this pattern with Power Automate run history, SharePoint audit logs, environment variables, retry policies, and child flows to create a more robust enterprise solution.

Conclusion

Scopes + Configure Run After are simple Power Automate features, but they can significantly improve the reliability and maintainability of complex flows.

Instead of building one large sequence of actions, structure your flow into logical sections and create dedicated error-handling paths.

Key takeaway:
Use Scopes to organize your flow and Configure Run After to control how your flow responds to success, failure, timeout, and skipped actions.

This TRY–CATCH–FINALLY approach is a strong foundation for building production-ready Power Automate solutions.