How To Write A D365 Display Method - TechNext 365

D365 display method x++

Problem:

The data that is to be shown on form is a calculated value and is not directly saved in database. It is displayed after the running of a certain code chunk.

Solution:

I will show you how you can use display method to show a calculated value on a form control step by step with an example. Let's begin.

Example:

Customer Service Form D365 FO
Customer Service Form D365 FO



Consider the example of customer service form, the control of "Allow on Account" is a displayed field of value YESNO. its value is not stored in database but it only displays value according to the sales order searched.

Step 1:

Define the display method. It can be defined as table methods, form methods, form data source methods, report methods and report design methods. In my case I am defining it as table method on custtable, it checks the value of  "Allow on Account" on MCRCusttable and displays the respected value on customer service form.

 public display NOYesId AllowOnAccount()

 {

          MCRCustTable     mcrcusttable;

          select AllowOnAccount from mcrcusttable

          where mcrcusttable.CustTable == this.RecId;

          return mcrcusttable.AllowOnAccount;

 }

Step 2:

Add the defined display method on form control as data method shown below:

First add the control on form.

Form Control on Customer Service Form

Step 3:

After adding control, set the properties of the control and set data method name.

Data Method Properties


Step 4:

After building the code check it on front end by searching a sales order on customer service form.

Display YesNO value

If you have any queries, comment below. Happy Daxing✌

1 Comments

  1. what if we have to create a display method of extended objects?

    ReplyDelete

Post a Comment

Previous Post Next Post