web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Orderby on annotated fields via the REST API

(0) ShareShare
ReportReport
Posted on by 25

Hi there,

I need to be able to apply an orderby clause to an annotated field (i.e. order on the "Case Created" string instead of the number 4 for the statuscode field on an incident entity).

Is this possible via the REST API?

When I attempt to use statuscode@OData.Community.Display.V1.FormattedValue in the orderby I get the following error:

{"error":{"code":"0x0","message":"Syntax error at position 54 in 'statuscode@OData.Community.Display.V1.FormattedValue asc'."}}

Please note the fields could be Option Sets or Lookup fields.

I might be able to use expand on a Lookup field but I don't believe this works on Option Sets?

Regards,

Andy

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello Andy,

    I'm afraid that won't work this way. What you can do is to get the data and sort it afterward.

  • Andy Whitworth Profile Picture
    25 on at

    Thanks for the quick response Andrew.

    Is there no other way of doing this?

    It would be very inefficient to download a large number (could be 100s or 1000s) of incidents to then perform client-side sorting on them and would ultimately lead to a poor end-user experience in our web application.

    Regards,

    Andy

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Andy,

    I can just second what I said. You can't do it in a direct way.

    But if you're ok with alternatives - you can store the label of the optionset in some text field and do the sorting by it.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 131 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 91

#3
Chris1968 Profile Picture

Chris1968 20

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans