How to create display method for table extension in Dynamics 365?

we don’t have the option to create methods on table extension, but we can do that via class extension

How?

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 prefix (_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 vendgrou::find(_this.vendgroup).name;
}
}
3-build project and check error if found 

4-Customize this method in your Form 
locate your form and create a new string to add this method in the form 

set the properties for the string as the below

Data method format must be ExtensionClassName::MethodName
Thanks. 

Comments