Forum Discussion

quickeyes9's avatar
quickeyes9
Copper Contributor
Oct 21, 2024

Sharepoint custom lis view sorting

Hello I am trying to figure out how sharepoint saves the order of a custom list view and how it can be extracted possibly ? Particularly when using drag and drop feature.  I need to extract with power automate in order to custom sort how I grab the items from the custom view , any ideas??

 

1 Reply

  • quickeyes9 

     

    How about by leveraging Power Automate:

     

    1. Create a Custom Column for Sorting:

      • Add a new column to your SharePoint list, such as “SortOrder” (Number type).
      • Manually update this column to reflect the order you want. For example, assign numbers 1, 2, 3, etc., based on the desired order.
    2. Update the Sort Order Using Power Automate:

      • Create a Power Automate flow to update the “SortOrder” column based on your drag-and-drop actions. This might involve using a combination of triggers and actions to capture the new order and update the column accordingly.
    3. Sort Items in Power Automate:

      • Use the “Get items” action in Power Automate to retrieve items from your SharePoint list.
      • Apply an OData filter query to sort the items based on the “SortOrder” column. For example:
        _api/web/lists/getbytitle('YourListName')/items?$orderby=SortOrder asc
        
    4. Custom Sorting in Power Automate:

      • Once you have the items sorted by the “SortOrder” column, you can process them in the desired order within your flow.

    Here’s a basic outline of how you can set up the flow:

    1. Trigger: When an item is created or modified in the SharePoint list.
    2. Action: Get items from the SharePoint list.
    3. Action: Apply to each item - update the “SortOrder” column based on the new order.
    4. Action: Use the sorted items for further processing.

Resources