Sort grid by selection field text

CRM 2020 R1 - I have a custom entity with a selection field in the list/grid page.  I want to sort the grid by the selection field text, but the grid sorts it by the field value (ie the code).  The codes are all numeric (imported from old system) so the grid appears to be in random order when it is 'sorted'.

How can I sort the grid by the selection field text rather than code?

  • If a connection to the old system is no longer relevant then surely it's just a 10 minute job to update the existing data and selection list definition?  There may be some more elegant solutions but I bet they would take longer.

  • Yes, that's what I'm planning.  There's also the issue of converting the data from the old app to import the historical info - a lot of lookup tables and so on but not impossible.

    I'm also considering joining Custom_Captions into the view.  I can then have the translations in the grid which should sort correctly.  That will work so long as there aren't any users that use a different language - probably ok in this case.  Or I could change the sql for the grid dynamically in the asp to include the user's language translation - that might work.

  • I've tested joining Custom_Captions into the view and then having the translations (Capt_UK) instead of the selection field in the grid and it works well.