DisplayMethod recap in Microsoft Dynamics 365 Finance and Operations apps
DisplayMethod recap in Microsoft Dynamics 365 Finance and Operations apps
There are a few rules for augmentation classes:
- They must be final.
- They must be suffixed by _Extension.
- They must be decorated with the [ExtensionOf()] attribute.
[ExtensionOf(tableStr(InventTable))]
final class MyInventTable_Extension
{
[DataEventHandler(tableStr(InventTable), DataEventType::Inserting)]
public static void InventTable_onInserting(Common sender, DataEventArgs e)
{
InventTable inventTable = sender as InventTable;
// Call the method as if it was defined directly on InventTable.
inventTable.defaultMyInventLocationId();
}
public void defaultMyInventLocationId()
{
// This would have partner specific logic to initialize the new field.
this.MyInventLocationId = this.inventLocationId();
}
}
can do that via class extension
for example:: we need to view vendor group name for the vendor in vendtable form
1-Create a new class and name it as <Classname>_<Extension>
so you can create this class with the below syntax
public static class Vendtable_Extension
{
}
Note:: the suffix (_Extension) is a must
2-Create the display methods in the class
public static class Vendtable_Extension
{
[SysClientCacheDataMethodAttribute(true)] //This attribute will cache your display method.
public static display Name VendGroupName(Vendtable _this)
{
return vendgroup::find(_this.vendgroup).name;
}
}

Like
Report
*This post is locked for comments