Description:-
This posts helps you to understand and create a
"display" method for the table extension.
Let’s say, the requirement is to add a method
in the standard table, it can be achieved either by creating a table
extension.
So in this scenario we had a requirement to add a display
method in the standard table "PurchTable".
In Dynamics 365 we won’t be able to add the new
method or modify the existing method to the standard table or to an extension
table.
It can
be achieved by using the extension class.
Step 1: Create a new class and name it as <Classname>_<Extension>.
<Class-name> - can be any name, but it is
preferred to give the table name for which the extension is being
created.
postfix <_Extension> is must.
public static class Purchtable_Extension { }
Step 2 : Now add the display methods in the class which is required to be shown.
public static class Purchtable_Extension { [SysClientCacheDataMethodAttribute(true)] public static display Name VendName(Purchtable _this) { DirPartyTable DirPartyTable; VendTable VendTable; select * from VendTable join DirPartyTable where DirPartyTable.RecId == VendTable.Party && VendTable.AccountNum == _this.OrderAccount; return DirPartyTable.NameAlias; } }
Step 3: To use this display method in the form.
Create a string control in
the form design and set the following properties
Data source: PurchTable
DataMethod: PurchTable_Extension::agreementId
CacheDataMethod: Yes
Step 4: Build/Rebuild the project/solution and check the output in the URL.
Thanks for comments.....