[D365] Add display method via Extension

Adding a display method to a standard table in D365 can be confusing because most parts of the documentation state it should be implemented as static method with the table as only parameter and writte in the control's Data Method like this: MyClass::staticDisplayMethod.

This does not only look ugly but there is a better way!

First, create an Extension class for the standard table you want to add the display method to:


New table extension class
Then implement your display method as instance method:

[ExtensionOf(tableStr(TmpPurchLine))]
public final class TmpPurchLine_Extension
{
	public display AmountCur myQtyField()
    {
    	return this.PurchQty;
    }
}

Create extension for standard form
Add a new control of the correct type to your design (example: Real control) and then set the property Data Source to the standard table you created your extension for and the Data Method property to the name of your extension class and display method connected by a dot. Example: TmpPurchLine_Extension.myQtyField


Table.method as property

Leave Comment

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