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

[Power Automate] How to Set Lookup Field Value in Common Data Service (current environment) Flow Connector

[Power Apps] Using Common Data Service's Lookup Data Type Field in Canvas App

Validating Document Upload in Business Process Flow by Setting Field Requirement Level Conditionally (Part 2 of 2)

Get the Lookup Display Name and Option Set Value Label in a Single Query Using a CDS (Current Environment) Connector FormattedValue Property

Move Attachment from File Field of CDS to SharePoint in Power Automate (Part 1 of 2)

Find out how to include a link to the record (Record URL) when sending an email from Dynamics 365/CDS using flow

[Power Automate] List Records - Use Expand Query to Retrieve Related Data in flow

Send Email from Dynamics 365/CDS with Attachment from Notes Using Flow

Getting the Lookup Attribute of the Parent Record in Power Apps Canvas App Development with Common Data Service (CDS)

How to Set Lookup Fields with Null Value from Dynamic Content in CDS (current environment) Connector