This tutorial is about “Power Automate get items order by.” In this Power Automate tutorial, I will guide you on how Power Automate ‘Get items’ flow action order by works.
The ‘Order By’ property of Power Automate’s ‘Get item’ flow action can effectively sort bulk items within a SharePoint list in either ascending or descending order based on the selected column.
I will show you a few examples of “get items order by in Power Automate”:
- Power Automate get items order by ascending.
- Power Automate get items order by date descending.
- Power Automate get items order by multiple columns.
Power Automate Get items Order By
The ‘Order By’ property in the ‘Get items’ flow action of Power Automate can be useful in automatically sorting SharePoint list items based on a selected column, thereby avoiding manual sorting.
When sorting involves multiple columns, Power Automate Order By follows a left-to-right sequence.
Order By Format:
The Order By property will only support the format as SharePoint internal column name with the order: asc for ascending and desc for descending.
Example: Duedate asc (or) Duedate desc
Power Automate get items ‘Order By’ property not supporting any other formats in it, including adding expression.
Power Automate Get items Order By Ascending
First, I will discuss the example of Power Automate get items order by ascending in a flow.
Here is the SharePoint list: This list has different types of columns. We wanted to sort the ‘Employee Full Name’ column in ascending order so that it would order the names in [A-Z] sequence using a flow.
For sorting a SharePoint list, I will build a Power Automate flow that will trigger manually. So, Let’s begin the steps to create a Power Automate flow.
1. Open a Power Automate Home page; click +Create in the left navigation -> Select ‘Instant cloud flow’ -> Provide a name for the flow, choose the trigger as ‘Manually trigger a flow,’ and click the +Create button. Now, the trigger is added to the flow studio.
2. Below the trigger, let’s add the ‘Get items’ flow action, which will fetch all the SharePoint list items and their values. Set the below details:
- Site Address: Select a SharePoint site address.
- List Name: Choose a specific list name from the dropdown.
- Order By: Add the below value in it.
3. To view the output of Power Automate’s get items order by condition, take a ‘Create HTML table‘ and provide values like below.
- From: Add the dynamic ‘Value’ of Get items.
- Columns: Select the ‘Custom’ table from dropdown.
Employee Full Name
|Select the values from the dynamic content under Get items.
4. At this point, the flow is ready to test. Click on Save and Test. Run the flow manually.
5. The HTML table’s body will display SharePoint list items sorted in ascending order based on the ‘Employee Full Name’ sequence, as seen below:
This is how to use Power Automate get items order by sorting the SharePoint list items.
Power Automate Get items Order By Date Column
Similarly, I will show you, Power Automate ‘Get items’ order by date in descending format.
To illustrate Power Automate ‘Get items’ order by date, I will refer to the SharePoint list previously used in the example above. Regarding the requirement, we need to sort the ‘Leave Date’ column values in descending order (Newer to Older).
Follow the same pattern of steps as the above example, but only change the Order By format in the ‘Get items’ flow action.
1. In the ‘Get items’ flow action of Power Automate, provide the Site Address, List Name, and Order By.
Order By: LeaveDate desc
2. The body of an HTML table will show the SharePoint list items with the sequence of ‘Leave Date’ in descending format as represented below:
This is how to use Power Automate get items Order By for sorting dates inside a flow.
Power Automate Get items Order By Multiple Columns
Finally, I will demonstrate the last example of Power Automate ‘Get items’ flow action order by multiple columns.
As mentioned, I will sort the SharePoint list items based on multiple columns. As per the client’s specifications, the items in the SharePoint list are required to be sorted by ‘Employee ID’ in ascending order, ‘Total Leaves’ in ascending order, and ‘Return Date’ in descending order.
Create a new Power Automate flow and change the ‘Order By’ format in the ‘Get items’ flow action.
1. Within the Power Automate ‘Get items’ flow action, give the Site Address, List Name, and Order By.
- Order By: Add the format as provided in the code.
LinkTitle asc, TotalLeaves asc, ReturnDate desc
For ordering the multiple columns, separate the SharePoint internal column name and order with a comma.
2. The screenshot below shows that the SharePoint list items are sorted based on multiple columns’ sorting.
This is how to work with Power Automate ‘Get items’ flow action ‘Order By’ property for sorting by a flow.
You can use the Power Automate ‘Get items’ Order By feature to sort and order the SharePoint list from a ‘Power Automate Get items Order By.’
This Microsoft Power Automate tutorial taught us how to use the Power Automate Get items Order By feature. Also discussed related topics like:
- Power Automate Get items Order By [ascending]
- Power Automate Get items Order By [date]
- Power Automate Get items Order By [multiple columns]
You may also like:
- Power Automate Get Items Filter Query Multiple Conditions
- Power Automate get items filter query not equal null
- Power Automate Get Items Filter Query Date
Preeti Sahu is an expert in Power Apps and has more than 6 years of experience working with SharePoint and the Power Platform. As a Power Platform expert for Power BI, Power Apps, Power Automate, Power Virtual Agents, and Power Pages, she is currently employed with TSinfo Technologies. She is the author of the book Microsoft Power Platform A Deep Dive. She also made a big technical contribution to SharePointDotNet.com in the form of articles on the Power Platform. She enjoys traveling and spending time with her family in her spare time.