How to filter display methods in D365 F&O

How to filter display methods in D365 F&O

In Dynamics 365 Finance & Operations (D365 F&O), fields that are based on display methods are not filterable on forms.
However, in real projects, clients often request filtering on such fields. Vendor name is one of the most common examples.

There are two possible approaches to make display-method-based fields filterable, but only one aligns with best practices and is safe for performance, extensibility, and future upgrades.

In this article, I’ll walk you through the recommended best-practice solution:
Replacing the display method with a view-based data source.

Business Scenario: Display Methods on Purchase Order Lines

On the Purchase Order Lines form, the Vendor name column is derived from a display method.
Because of that, the column:

  • ❌ Cannot be filtered

  • ❌ Cannot be sorted properly

  • ❌ Is evaluated row-by-row at runtime

Our goal is to make Vendor name filterable while keeping the solution upgrade-safe and performant.

Why Not Use a Display Method?

Display methods:

  • Are calculated at runtime

  • Do not participate in SQL queries

  • Cannot be used in filtering, sorting, or grouping

Microsoft’s best practice clearly states:

If a field needs to be searchable, sortable, or filterable, it must come from a table or a view.

That’s exactly why we’ll use a view.

Solution Overview (Best Practice)

We will:

  1. Create a view that exposes the required fields

  2. Add a relation between the primary table and the view

  3. Add the view as a form data source

  4. Replace the display method with the view field

  5. Remove the obsolete display method

Step-by-Step: Replace Display Methods with a View

Step 1: Create a View

Create a new view, for example:

VendTableName_CAP

Metadata (Data Sources)

Add the following tables:

  • VendTable

  • DirPartyTable

Create a relation:

VendTable.Party == DirPartyTable.RecId
 

Fields

Expose the following fields in the view:

  • VendTable.AccountNum → Used for joining with the form datasource

  • DirPartyTable.Name → Replaces the display method

At this point, your view returns Vendor account + Vendor name in a SQL-friendly way.

Create a view to replace display methods in D365 F&O

Step 2: Add a Relation on the Form Data Source Table

In our case, the primary form datasource is PurchLine.

On the PurchLine table:

  1. Create a new relation to the view VendTableName_CAP

  2. Map: PurchLine.VendAccount == VendTableName_CAP.AccountNum

This ensures that the form can correctly join PurchLine records to the view.

Add a Relation on the Form Data Source Table​

Step 3: Add the View as a Form Data Source

On the Purchase order lines form:

  1. Add VendTableName_CAP as a new Form Data Source

  2. Set the following properties:

PropertyValue
JoinSourcePurchLine
LinkTypeInnerJoin
TableVendTableName_CAP

This makes the view participate directly in the form query.

Add the view as a form data source to replace display methods

Step 4: Add the View Field to the Grid

Now:

  1. Add VendTableName_CAP.Name to the grid

  2. Bind it directly to the view data source

The field is now:

  • Filterable

  • Sortable

  • SQL-backed

  • Performance-friendly

Add the view field to the grid instead of display methods

Step 5: Remove the Display Method

Once the view-based field is confirmed working:

  • Remove the old display method

  • Clean up unused code

This keeps your solution clean and aligned with best practices.

By replacing display methods with a view, the field becomes part of the form query, so users can filter and sort it like any other column.

Final Result: Filterable Fields Without Display Methods

  • Vendor name is now filterable
  • Works with standard grid filtering
  • No runtime display method execution
  • Upgrade-safe and extensible

The form behaves exactly as users expect:

  • Sort A → Z / Z → A

  • Filter on the field

  • Better performance on large datasets

Questions or Feedback?

If you have any questions, need clarification, or want to discuss D365 F&O best practices, feel free to reach out.
I’m always happy to help and exchange ideas with the community.

👉 Contact me here: https://ebregu.com/contact/

Share this post

Found this useful? Help others discover it.

Leave a Comment

Your email address will not be published. Required fields are marked *