Get JSON Output of Steps with Status Reason 200 in Power Automate

The JSON output in the run history of the List records action step from the Common Data Service (current environment) connector is useful for troubleshooting purposes or getting the sample data for Parse JSON action. It is also useful when you need to see the attributes which are not listed in 'Dynamics content' pane (e.g.  OData.Community.Display.V1.FormattedValue properties, or attributes from 2 or more level $expand query or alias values from <link-entity> in FetchXml query). But there are times when the output is shown as “Status Reason: 200” instead of the "Click to download" URL which lets you open the JSON output, so how do you go about this? There are several reasons why you get the “Status Reason : 200”:
  • For the normal WebAPI query, it happens when you have a small amount of record (e.g. less than 10 – but it is inconsistent with the exact number and sometimes, it varies depending on the Select Query. I couldn’t really figure out and 😅 let me know in the comment if you know the exact reason). 
  • For FetchXML Query, it is just shown Status Reason: 200 regardless of the number of result records. 
In this post, I will show you a couple of ways on how you can get the output JSON for the  scenarios I mentioned above.


UPDATED: 
This is the new feature that I learned from Claire Carmichael in the Monthly Flow Surgery event by Virtual Power Group Scotland. You can now simply click on the "Show raw outputs" link 

This is the outcome.



Alternative methods
1. Add the Compose step

If the JSON output is just required for analysing the schema or to use as the sample data for Parse JSON action in the development environment, you can add the Compose step after the List records step and re-run the flow.

@{outputs('List_Accounts')}

If you need the whole output of the List records step, the expression above needs to be used (with the name of your List records action) because the whole output is not available in the Dynamic Value list. In most of the scenarios, the value from the Dynamic Value list is sufficient.


The output JSON can be obtained from the Compose step as in the screenshot below.


2. Get from Flow Run History

If you are troubleshooting a particular flow run in the production or you cannot edit and re-run for some reason, another option to get the JSON output is by downloading the run history and locate the URL of JSON output in it.

2.1 Click on All runs under the flow page

2.2 In the Run History page, Click on Get .csv file
2.3. Once the download file is processed, click on the Download file link.

2.4 Open the downloaded .csv file in Excel and locate the row of the flow run that you need. (the easiest way for me is to find (Ctrl + F) with the flow run GUID or the GUID of the triggering record.

Once you can find the correct row of the flow run that you want to troubleshoot, find the correct column by checking the name of the step + " - output". (in my case, the column name is "List_Accounts - output")
From the correct row and correct column, get the uri of the bodyContentLink as highlighted in the screenshot below and open the URL in the browser.

When the URL is opened in the browser, you will see the JSON output like below.


💡 Tip

Install one of the JSON Formatter browser extension like this to save yourself from copying the JSON output of the URL and formatting in another tool.

Comments

Popular Posts