The D365 Display method is a potent feature in Microsoft Dynamics 365 Finance and Operations (D365FO) that enables developers to display derived or computed values on forms and reports without saving them in the database. This useful method of dynamically displaying data based on other data fields enhances the user experience.
Effective D365 development requires knowing how to use the D365 Display technique, whether you're extending standard functionality, creating SSRS reports, or customizing forms.
A D365 Display Method: What Is It?
In D365FO, a method that has the [Display()] property that is declared in a table or class is called a Display method. Although it is not stored in the database, it returns a value that can be displayed on forms, grids, or reports. These techniques are frequently employed when you wish to:
On a form, display a calculated field.
Show a name or lookup associated with a foreign key.
Before displaying values on a user interface, format them.
Provide users with more details without changing the table schema.
D365 Display Method Syntax
This is a basic illustration of a table's Display method:
[Given the Full Name),
This is the result of calling public str fullName(). This.LastName + + FirstName; }
In this example, the whole name is displayed on a form by concatenating the FirstName and LastName fields.
The D365 Display Method: A Guide for Developers
Make the method in a class or table
Select if your Display function will be in a class (for generic or calculated data) or a table (for row-level data). Above the method definition, add the [Display] attribute.
Utilize on a Grid or Form
Once the method is ready, you may bind it in a form grid or drag it into the design of a form in Visual Studio. Although it is read-only, it will function similarly to a regular field.
Utilization in SSRS Reports
The Display method can be used as a field in SSRS reports after being exposed in the AOT data provider of a table. This keeps the data model from becoming bloated while displaying calculated fields.
Make Performance Your Top Priority
Because Display methods are called frequently during form rendering, steer clear of lengthy loops or intricate calculations. Caching should be used when needed.
When Are Display Methods Appropriate?
when derived values are required but not wanted to be stored in the database.
to display values from related fields (such as client names from a linked table).
to format display items (such as conditional values and currency formatting) for reading.
when minimizing schema modifications during customization is your goal.
Top Tips for D365 Display Techniques
Keep them efficient and light.
To guarantee visibility in the user interface, always use the [Display] attribute when decorating.
Stay away from using business logic in Display methods.
They are read-only by design, therefore don't utilize them for write-back operations.
Typical Use Cases: Displaying the Complete Customer Name in the Sales Order Header
Using exchange rates to display currency conversion
Stock Status Display in Product Views
Displaying Formatted Amounts or Dates
Find Out More
Do you want to learn more about how to apply and utilize the D365 Display technique efficiently? Check out this useful Dynamics Community 101 guide:
Method for D365 Display - dynamicscommunity101.com
In conclusion
One essential tool for Dynamics 365 developers who wish to display dynamic and easily navigable data in forms and reports is the D365 Display technique. You can improve the user interface without changing the underlying database structure if you know when and how to apply these techniques.