Thursday 17 December 2020

HOW TO SORT LOOKUP FIELD IN A CUSTOM ORDER IN DYNAMICS 365?

In this blog we will learn how to sort a lookup field in a custom order in Dynamics 365.

Sorting makes it easy for us to get a quick overview of the data. For example, if we have many customers, we could sort them by Customer No., Currency Code, or Country Region Code to get the overview we need.

Consider a scenario, on a Work Order we have Incident Type and the values in the lookup sort based on the primary field. If we must sort the Incident Type records based on the priority.

 Incident Type records

We have to create a field for priority which can be either Single Line of Text or Whole Number.

Navigate to Advanced Settings -> Customize the System

Expand the required entity and select Fields and create a new field.

Then add the field on to the form to provide the Priority.

For lookup values, there is by default a view is created “<Entity Name> Lookup View”, here in our scenario Incident Type Lookup View.

Open the Incident Type Lookup View and from Add Columns, select the Priority field which is created.

Add Columns

Sort the view on Priority either in Ascending or Descending order based on the requirement.

Click -> Configure Sorting -> provide Sort By and Select either Ascending or Descending

Configure Sort Order

Now open the form where we want to sort the Lookup value.

In the Field Properties, Under Display tab turn off recently used items.

Disable Most Recently

Configure the Default View as the view we have configured, Incident Type Lookup view.

Incident Type Lookup View

Save and Publish the Customizations.

Now in the form we can see the Sorting order of the Incident Type Lookup view based on the Priority.

Look for Incident Type

Other way round to achieve this is adding a prefix to the records, e.g.,

  • 1 – Test & Inspect
  • 2 – Support – Phone
  • 3 – Internal

No comments:

Post a Comment

Open HTML Page from Button with Ribbon Workbench

There may be a requirement to open an HTML page from a button. In this example, we will use the Ribbon Workbench to open a page from a butto...