Sorting Dynamics 365 views, you can only sort the field that is selected in the column for the view. You can’t able to select a field for sorting which is not part of the selected attribute to be viewed. But there are occasions where you still need to sort but don’t need to show the field that is used to sorting in the view.
The scenario is, in a lookup view, you need to sort the records based on a custom sequence number that is part of the reference data.

The problem here is, if you only add the sequence number field to the view, then only you can sort using that field. From a usability stand point of view, the sequence number that shows in the lookup dropdown makes the dropdown more clumsy and also it occupies more real-estate thus prevents in viewing more values in the lookup.

The solution to this problem is, you add that field in the view and configure the sorting based on the field i.e. Sequence in the customization. Then comes the trick that will help make that unnecessary column to hide. Use the plugin called View Designer in the XRM Toolbox.

Open the plugin in the XrmToolbox, click on the Open button, this will list all the entities in the dropdown as shown below. Choose the entity in the entity dropdown, then pick the view that you need to customize in the view dropdown.

Click Ok to open the view customizer. Click on the “Select Columns” option, this will open the column list as below. In that list, uncheck the column that you need to hide. Click OK.

Save the changes, then click Publish to publish the change that you just made. Now look at the change that it made in the lookup. The sorting’s are intact and the column is also hidden from the lookup view.

OBSTACLES DON’T BLOCK THE PATH.
THEY ARE THE PATH.
ZEN