In Dynamics 365 for Finance and Operations, display
methods are still used in some places to show additional information on forms or reports such as fields, calculations, and more. Although they are shown as physical fields, their values are a result of the methods to which they are bound.
The display
methods are executed each time the form is redrawn. This means that the more complex the method is, the longer it will take to display it on the screen. Hence, it is always recommended to keep the code in the display
methods to a minimum.
The performance of the display
methods can be improved by caching them. This is when a display
method's return value is retrieved from a database or calculated only once and subsequent calls are made to the cache.
In this recipe, we will create a new cached display
method for the PaymentTerm description. We will also discuss a few scenarios in order to learn how to properly use caching.