Search This Blog

Showing posts with label Display method. Show all posts
Showing posts with label Display method. Show all posts

Tuesday, August 23, 2022

Create display method on the existing table using Extension in Dynamics 365 Finance and Operation

Display method used to create when we need to do some calculation on numeric or some string operation and then we need to display it on the form. Try to avoid creating display method as it causes performance overhead. 

Example :

suppose we wanted to display new field on the customer group form which will show the customer group id with the desciption. To achieve the same, we need to create the display method. We can create by creating extension of the form or of the table. 

I have created code extension of the CustGroup table and created the below code.

/// <summary>

/// Extension of the CustGroup table has been created to add some display method

/// </summary>

[ExtensionOf(tableStr(CustGroup))]

final class CustGroup_FOTraining_Extension

{

    /// <summary>

    /// Display method

    /// </summary>

    /// <returns>Customer group with name</returns>

    [SysClientCacheDataMethodAttribute(true)]

    public display TRNGroupWithName displayGroupWithName()

    {

        //your logic goes here

        return this.CustGroup + this.Name;

    }

 

}


And now we will create the extension of the CustGroup form to add the new field which will display the above values

so we can create the new string type field with the below properties. 






and the output will be as per below