Skip to main content
Post

How to Track the Current Progress of a Flow in PowerApps

How to Track the Current Progress of a Flow in PowerApps

Flow Progress Overview

In some scenarios, you or your users would like to see how far a Cloud Flow process (Power Automate) has progressed after starting it via PowerApps.

Unfortunately, it’s not possible to use “Respond to PowerApps” multiple times to show status updates in the PowerApp during flow execution.

💡 The Solution: StateLog Table with Timer

For this challenge, we can easily create a StateLog table and check it regularly via a timer control. The key is to send updates to the StateLog entry after reaching important milestones in the flow.

sequenceDiagram
    participant App as Power App
    participant Flow as Power Automate
    participant Log as StateLog (SharePoint)
    App->>Flow: Run(GUID)
    Flow->>Log: Create item (GUID, StateCode 0, "Flow started")
    Flow->>Log: Update item at each milestone
    loop Every 3s (Timer)
        App->>Log: Refresh + LookUp(GUID)
        Log-->>App: Current StateCode / Title
    end
    Flow->>Log: Update item (StateCode 3, "Complete")
    App->>Log: LookUp(GUID)
    Log-->>App: StateCode 3
    App->>App: Show "Complete", stop timer

🛠️ What You Need for Implementation

  • Flow Trigger → Button in your app
  • Timer Control → To refresh the data periodically
  • Status Display → Text labels and icons
  • StateLog Table → SharePoint list for state tracking

📊 Setting Up the StateLog Data Source

SharePoint List Overview

Build a data source with three columns:

  1. Title (default column) - for status descriptions
  2. GUID (text column) - for filtering by unique flow instance. Note: SharePoint may create this column with the internal name GUID0 (as in the flow excerpt below). In Power Apps you work with the display name GUID, in the flow action the internal name is used. Check the internal name of your own column before you copy anything.
  3. StateCode (number column) - for programmatic status handling

⚡ Configuring the Power Automate Flow

Cloud Flow Overview

Create a flow with this structure:

  1. PowerApps trigger - receives GUID from the app
  2. Create Item - immediately creates StateLog entry with:
    • GUID (from PowerApps)
    • Initial status (StateCode 0)
    • Title: “Flow started”
  3. Scope blocks - your actual business logic
  4. Update Item - after each milestone, update the status
  5. Error path - add a parallel branch that runs only when the scope fails (Configure run after: has failed / has timed out) and sets StateCode 9 with the Title “Failed”

The scopes named “Flow Actions” are symbolic - use any actions you need. After important milestones, simply update the status (or create additional entries for detailed logging).

📱 PowerApps Implementation

PowerApps Overview

1. Flow Trigger Button

On the button’s OnSelect property:

// Generate GUID for tracking
Set(varStateGUID, GUID());

// Start polling and the Flow with this tracking ID
Set(varPolling, true);
wfState.Run(varStateGUID)

2. Timer Control Configuration

Timer Settings:

  • Duration: 3000 (3 seconds)
  • Start: varPolling
  • Repeat: true

OnTimerEnd:

Refresh(StateLog);
UpdateContext({
    locCurrentState: LookUp(
        StateLog,
        GUID = Text(varStateGUID)
    )
  });
If(
  locCurrentState.StateCode = 3 Or locCurrentState.StateCode = 9,
  Set(varPolling, false)
)

3. Status Display

Show the current status using:

locCurrentState.Title

You can also display different icons based on StateCode:

Switch(
    locCurrentState.StateCode,
    0, "⏳ Starting...",
    1, "🔄 Processing...", 
    2, "⚙️ Finalizing...",
    3, "✅ Complete!",
    9, "❌ Failed"
)

💾 Complete Flow Code

Excerpt of the flow definition (the first action only, with environment-specific values replaced by placeholders). It shows the structure and is not meant to be imported as is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{
  "id":"<flow-id>",
  "brandColor":"#8C3900",
  "connectionReferences":
  {
    "shared_sharepointonline":
    {
      "connection":
      {
        "id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/<connection-id>"
      }
    }
  },
  "connectorDisplayName":"Control",
  "icon":"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KIDxwYXRoIGQ9Im0wIDBoMzJ2MzJoLTMyeiIgZmlsbD0iIzhDMzkwMCIvPg0KIDxwYXRoIGQ9Im04IDEwaDE2djEyaC0xNnptMTUgMTF2LTEwaC0xNHYxMHptLTItOHY2aC0xMHYtNnptLTEgNXYtNGgtOHY0eiIgZmlsbD0iI2ZmZiIvPg0KPC9zdmc+DQo=",
  "isTrigger":false,
  "operationName":"LogState",
  "operationDefinition":
  {
    "type":"Scope",
    "actions":
    {
      "Create_item_-_Flow_started":
      {
        "type":"OpenApiConnection",
        "inputs":
        {
          "host":
          {
            "connectionName":"shared_sharepointonline",
            "operationId":"PostItem",
            "apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
          },
          "parameters":
          {
            "dataset":"https://<tenant>.sharepoint.com/sites/<site>",
            "table":"<list-id>",
            "item/Title":"Flow started",
            "item/GUID0":"@triggerBody()['text']",
            "item/StateCode":0
          },
          "authentication":"@parameters('$authentication')"
        },
        "runAfter":{},
        "metadata":
        {
          "operationMetadataId":"<metadata-id>"
        }
      }
      // Additional flow actions...
    }
  }
}

🎯 Key Takeaways

  • Real-time tracking: Monitor flow progress without blocking the UI
  • GUID-based: Each flow instance is uniquely trackable
  • Flexible updates: Update status at any milestone in your flow
  • User feedback: Provide clear progress indication to users
  • Scalable: Works with any complexity of flow logic

💡 Alternative Approaches

Instead of updating the same StateLog entry, you could:

  • Create new entries for each milestone (provides detailed history)
  • Use different StateCode values for more granular status tracking
  • Add timestamps to track duration of each phase
  • Use dedicated error state codes (this post uses 9 for “Failed”) so the app can show what went wrong

🔄 Enhanced Timer Logic

For better performance, you might want to:

  • Increase timer duration for longer flows (reduce SharePoint calls)
  • Stop timer automatically when flow completes

This solution provides a robust way to track Power Automate flow progress in real-time, giving your users visibility into long-running processes and improving the overall user experience.

🔸 #PowerPlatformTip 147: ‘Dummy Patch for Complex Flows’ - refresh just the affected record once your flow finishes, instead of polling a whole gallery.

🔸 #PowerPlatformTip 51: ‘Which Flow Calls Which Flow’ - trace flow-to-flow triggers when the process you’re tracking spans multiple flows.

This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).

This post is licensed under CC BY 4.0 by the author.

Microsoft and the Power Platform product names (for example Power Apps, Power Automate, Copilot Studio) are trademarks of the Microsoft group of companies. This is an independent website. It is not operated, sponsored or endorsed by Microsoft.