web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get ALL flow ru...
Power Automate
Unanswered

How to get ALL flow run history

(1) ShareShare
ReportReport
Posted on by 256

Hello,

 

I have a specific flow that need more attention and I would like to use an automation process that will get all the flow run history.

I have found some articles that describe how to build an custom connector that could do that, for example: Custom connector to get flow run history.

The problem is that will return only the "last 50" runs and I don't find a way to use the "nextLink" or "$skiptoken" attribute from the resulting JSON that looks like this:

 

 

{
 "value": [
 {
 "name": "RunName-1",
 "id": "/providers/Microsoft.ProcessSimple/environments/...",
 "type": "Microsoft.ProcessSimple/environments/flows/runs",
 "properties": {
 "startTime": "2021-12-03T15:43:06.2437584Z",
 "endTime": "2021-12-03T16:46:17.7240414Z",
 "status": "Succeeded",
 "code": "Terminated"
 }
 },
 {
 "name": "RunName-2",
 "id": "/providers/Microsoft.ProcessSimple/environments/...",
 "type": "Microsoft.ProcessSimple/environments/flows/runs",
 "properties": {
 "startTime": "2021-12-03T14:30:40.9044521Z",
 "endTime": "2021-12-03T14:30:48.4232059Z",
 "status": "Succeeded",
 "code": "Terminated"
 }
 }
 ],
 "nextLink": "https://emea.api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/{EnvironmentName}/flows/{FlowName}/runs?api-version=2016-11-01&%24skiptoken=eyJuZXh0UGFydGl0aW9uS2V5IjoiMSE4IVFUaEVRakEtIiwibmV4dFJvd0tleSI6IjEhODQhTXpWRVJUaEJRVVV5TURjek5FRTRSRGszUWpJM05UTTNRams0UkRCRE5ERmZNRGcxT0RVMk16QTJOVFUyTVRneU5UZ3lORGN3TVRBNU16STRNRGstIn0%3d"
}

 

 

I have tried to find some inspiration in the article Microsoft Graph Delta Query from Microsoft Flow: Part 2 but I cannot find enough information how to adapt it to flows.

 

Does anybody have successfully automate the process of getting all the run history? I would like to avoid manually download the CSV file history or use an "desktop flow" to download that CSV file.

 

Kind Regards,

Lucian

Categories:
I have the same question (0)
  • diogoamorimdev Profile Picture
    on at

    Hi Lucian.

    Did you find a way?

    I'm trying to do this as well.

  • Lucian Profile Picture
    256 on at

    Hi @diogoamorimdev ,

     

    Unfortunately I wasn't able to find a way.

    Even with another example posted by @SimonSays into another similar topic (Link to Cloud Flow Run History) that it seems a great idea, except I'm lacking of some basic knowledge using HTTP request and "tokens" and did not find a way to use it.

     

    As a workaround, I have put in the flow I want to monitor, the required actions to record the flow run information in my dataverse table.

     

    But I'm still searching for an option to gather this information outside of the "original flow".

     

    Kind Regards,

    Lucian

  • Cat Schneider Profile Picture
    488 Most Valuable Professional on at

    @Lucian, have you tried pulling the data into Power BI? I've had some success with using the nextlink/$skiptoken pieces when connecting via weblink. I can't say if it would also work in this instance, but it's something to try.

     

    Bonus tip: if you're not in a GCC or higher-restricted tenant, you might be able to use the Power Automate Visual within Power BI to re-run failed flows.

    Let me know if you try any of this out and have some success.

  • Lucian Profile Picture
    256 on at

    Hi @CatSchneider ,

     

    No, I did not try in Power BI because I need the data in Dataverse.

    Anyway, which would be the connector for Power BI to get data directly from flow runs not by using the CSV file?

     

    Kind Regards,

    Lucian

  • santi_95 Profile Picture
    77 on at

    Anyone have any luck with this Im stuck on the same issue.

  • John_Dang Profile Picture
    Microsoft Employee on at

    Hi guys, 

    It seems like there is no official document for that, you can check this User blog:

    https://ashiqf.com/2021/05/09/everything-to-know-about-power-automate-rest-api-to-manage-and-administer-your-flows/

  • Langley Profile Picture
    on at

    seems only way is build an action in the end of your flow to record the running result.

    Track Flows using Power BI - Power Platform Community (microsoft.com)

  • Eladzeev Profile Picture
    2 on at

    function Get-FlowRunsByDate {

        param (

            [string]$EnvironmentName,

            [string]$FlowName,

            [DateTime]$StartDate,

            [DateTime]$EndDate,

            [string]$AccessToken

        )

        $baseUrl = "https://emea.api.flow.microsoft.com"

        $endpoint = "/providers/Microsoft.ProcessSimple/environments/$EnvironmentName/flows/$FlowName/runs"

        $apiVersion = "2019-10-01"

        # Construct the URL with the start and end time parameters

        $url = $baseUrl + $endpoint + "?api-version=$apiVersion&startTime=$StartDate&endTime=$EndDate"

        # Construct the headers with the access token

        $headers = @{

            "Authorization" = "Bearer $AccessToken"

        }

        # Create an array to store all the results

        $allResults = @()

        # Initialize the URL for the first page

        $nextPageUrl = $url

        # Loop through each page of results

        while ($nextPageUrl -and $proceed -ne $false) {

            # Make the API request using Invoke-RestMethod

            $response = Invoke-RestMethod -Uri $nextPageUrl -Method GET -Headers $headers

            # Process each item in the current page

            foreach ($item in $response.value) {

                # Get the start date of the current item

                $itemStartDate = [DateTime]::Parse($item.properties.startTime)

                # Check if the item start date is within the query time range

                if ($itemStartDate -ge $StartDate -and $itemStartDate -le $EndDate) {

                    # Add the item to the array of results

                    $allResults += $item

                }

                else{$proceed=$false}

            }

            # Check if there is a next link in the response

            if ($response.nextLink) {

                # Set the URL for the next page

                $nextPageUrl = $response.nextLink

                        }

            else {

                # No next link, exit the loop

                $nextPageUrl = $null

            }

        }

        return $allResults

  • AlanRoberts Profile Picture
    2 on at

    The flow run history is stored in the Flow Runs table so you could try querying that using the Dataverse connector.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard