I have a Get Records element in a flow which is supposed to return 16 records in ASC order based on a field called Ranking__c (Number data type). And then I have a loop which goes over these 16 records.

enter image description here enter image description here

The problem is that the first record that is processed in the loop is the 10th rank record as opposed to the 1st rank record.

I know I can start the ranking from 10 and go till 26 which should (hopefully) solve the problem but want to know if I'm doing something wrong?!

Update (adding a coupla screenshots):

This is the order that the records were returned from the Get Records element: enter image description here

I queried the records using SOQL without the ORDER BY Ranking__c ASC keyword and I get the results in the exact order as in the Get Records element: enter image description here

  • How are you sorting the results? Can you share your flow screenshot? Commented Mar 23, 2023 at 16:24
  • I can't post the flow screenshot as I'm dealing with some sensitive data. If you see the Debug Details screenshot, it says Sort records by: Ranking__c (Ascending).
    – apz
    Commented Mar 23, 2023 at 16:27
  • @MohithShrivastava - I added some more details in the question if it helps. The Get Records element is definitely not sorting the records in asc order
    – apz
    Commented Mar 23, 2023 at 16:49

1 Answer 1


After some research, I found out that this is a known issue: Custom Metadata Type not being sorted as expected

Workaround for my case was to add a Collection Sort element and use the Ranking__c field to sort it in ASC order.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .