Is there a workaround to handle order-by in cross-Object metadata relationships?

So Here is the querry.

SELECT Id FROM Child__mdt ORDER BY Parent__r.Order__c ASC

where Parent and Child are the Custom Metadata types.

The error I get.

UNKNOWN ERROR: INVALID_OPERATION: The requested operation is not yet supported by this SObject storage type, contact salesforce.com support for more information.

1 Answer 1


As the error says, you can't sort via SOQL. The only "workaround" is the typical "implement a wrapper class that implements Comparable." For example, you could implement a variant of this class, or this class, or even just implementing your own sorting algorithm. Hopefully this will be implemented in a future release, but I couldn't find any Known Issues or Ideas related to that (please feel free to edit it in here if you find/submit something).

You must log in to answer this question.

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