Showing results for 
Search instead for 
Did you mean: 

Sort order in an ADO (Azure DevOps) query is not being honored when using Azure DevOps Connector: Get query results


Correctly configured/sorted query in ADO is not sorted the same way in Microsoft Flow output when using "Get query results" and "Create HTML table".

Desired outcome:

Create a table with my desired sort using Microsoft Flow based on an existing ADO configured query.


I'm using the Azure DevOps (ADO) connector "Get query results" to create an HTML table in an email. The query in ADO is configured correctly, along with the desired sorting (By Application, By Assembly, By Bug Type). From ADO I can use the "Send query to Outlook" and the table created in email appears with the properly sorted data.


When I use the "Get query results" connector combined with the "Create HTML table" function (I use the custom feature to create my own headers for field values), the table output is NOT sorted in the same order as it is configured in ADO. In fact, the table is simply sorted by ID (WorkItem ID). Which is not a value I even use in my table output.


Am I missing something? Shouldn't the "Get query results" retrieve data in the order the resulting data query (remember, when I'm in ADO and click Send Query to Outlook, the table generated is sorted correctly) or is "Create HTML table" automagically doing something with the data that breaks the desired sorting done by the query?


Thanks for any help and pointers on correcting this.




Community Support
Community Support

Hi @lfbenitez1 ,


Could you please share a screenshot of the configuration of your flow so we would better understand your requirement?


Best regards,



Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Alice, thanks for responding.

Here is my Flow configuration using "Get query results" and "Create HTML table":

Flow Table Config and ADO Query Connect.jpg


Below is what is configured in Azure DevOps for the actual query.


This is the query:

ADO Query.jpg

These are the columns I "show" in ADO:

ADO Columns Selected in Query.jpg

This is the Sorting criteria (which works in ADO) I have defined in ADO:

ADO Sorting in Query.jpg


As I mentioned in the original post and above, the Sorting in ADO works when I run the query in ADO; however, when I grab the query from Flow and then place values in a table and output it in an email, the data is sorted BY "ID"...which is NOT even in my ADO sorting criteria. I WANT my Flow output to be in the same sort order as the original ADO query.

New Member

I'm having the same issue, has this issue been solve?



I'm facing the same issue. I tried sorting by standard columns, such as Assigned To, as well as custom columns, and it always returns the results sorted by ID. It seems like maybe this is coming from ADO this way. If I test the flow and look at the output of the Get Query Results step, it shows the raw data, and it's sorted by ID. I guess it's not something that can be controlled by the Flow, but I'm not sure how make ADO return the sorted results.  Any tips would be appreciated.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,533)