最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

标准应用程序对象上的 编辑/显示或新方法 / Edit/Display or new methods on standard application objects [#Dyn365FO]

网络文摘 William 98浏览 0评论
Hi Folks, Let’s see how to write new method on standard application object using extension framework. An extension enables you to add functionality to existing model elements and source code. Before starting adding new method, you need to create a new extension class for your object and this class should be declared as final and post fixed by ‘Extension’ keyword. See below example, For Table: [ExtensionOf(tableStr(CustTable))] final class MyCustTable_Extension { <new methods> } For Class: [ExtensionOf(classStr(CustExchAdj))] final class MyCustExchAdj_Extension { <new methods> } For Form: [ExtensionOf(formStr(VendParameters))] final class MyVendParameters _Extension { <new methods> } Now lets see how to add different types of methods 1. New edit method For Extension methods, the first argument in method parameter must be the object you're extending e.g. table buffer. See below code for reference; public static edit str60 MyFieldEdit(<tableName> _this, boolean _set, name value) { MyTable mytable = <tablename>; if(_set) { if(value) { ttsbegin; custTable = CustTable::find(<tablename>.CustAccount,true); custTable.Name = value; custTable.update(); ttscommit; } } } 2. New display method public static display EcoResDescription productName(InventSum _this) { Return _this.itemName(); } 3. Normal method In the same way you can write a new method, this method also need to be static so it can be access on form. Public static updateSearchName(_this, Name _newName) { Mytable mytable = _this; If(_newname) { Ttsbegin; Mytable.searchName = _ newname; MyTable.update(); Ttscommit; } } Edit method on table extension or new methods on table extension, all method need to be static. Now to access these methods, go to your form and Add new field type of string/real/xyz. Set below property Cheers, Harry  
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址