Visual Workflow Issue – Get Records Element Not Sorting Correctly in Flow

visual-workflow

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

Best Answer

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

Related Topic