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

Dynamics 365 FO中的List panel控件#MSDyn365FO / List panel control in Dynamics 365 FO #MSDyn365FO

网络文摘 William 194浏览 0评论
Hi Folks, A list panel is an interactive control to assign multiple values to a record. It let the user select multiple records against selected record on a form/grid. To understand it better let's take an example, I want to assign vendor group(s) to an employee so he/she can access those vendor related stuff like Masters, Transactions or PR creation (I am not covering the security in this post, its only about the List panel control). In today’s post I will be creating a new object for a random example, in real time you may need to tweak the solution to fit your requirement. To do this what I need are 1. A new table to store these data. 1 Employee: N Vendor Groups 2. A new form where I can select an employee and then select one or many vendor groups to this selected employee. 3. List panel on this new form to do actual operation. First, let's see how my form and table should look like, imageimage and your table browser should look like below, image To achieve this setup you need to create a new table as below image and new form as below, image Now, lets coming to coding part. Although there are many ways to achieve this setup, the best I would recommend is by using  SysListPanelRelationTableCallback framework class. By using this class you can achieve this with minimal coding. You need to add a group on from here we have ListPanelGroup which will be used to create list panel control. Overwrite init method on form and paste below code. A. Initialize the control. SysListPanelRelationTableCallback    listPanel; //Yes its out side of init method Winking smile public void init() { listPanel = SysListPanelRelationTableCallback::newForm(element, element.controlId(formControlStr(DpkVendorGroup, ListPanelGroup)), //1 "Selected Groups", //2 "Remaining groups",//3 0,//4 tablenum(DpkEmployeeVendGroup),//5 fieldnum(DpkEmployeeVendGroup, VendGroupId),//6 fieldnum(DpkEmployeeVendGroup, EmpName),//7 tablenum(VendGroup),//8 fieldnum(VendGroup, VendGroup),//9 [fieldnum(VendGroup, VendGroup), fieldnum(VendGroup, Name)],//10 0, //11 '',//12 '',//13 '',//14 '');//15 super(); listPanel.init(); } here
  1. Form control
  2. Caption for available records in the list
  3. Caption for selected records in the list
  4. ImageId (e.g. #ImageUser)
  5. Relation table: new table which we created to store data.
  6. Relation field: Field which you need to save in table from the list.
  7. Relation range field: Source field which you want to select in relation to binding with related field.
  8. Data table: Source table for list records. here we have VendGroup table.
  9. Data field: Field to be selected from list panel control.
  10. Data container field Ids: Fields that you want to show in available records.
  11. dataRangeField
  12. dataRangeValue
  13. validateMethod
  14. selectedMethod
  15. availableMethod
11-15 parameters can be used to further manipulate the control with some validations. B. Tab change Now add a new method on the form to fill the list for previously assigned records void tabChanged(int fromTab, int toTab) { #define.TabEmplOverview(1) #define.TabvendGroup(2) switch (toTab) { case #TabvendGroup: listPanel.parmRelationRangeValue(HcmWorker.name()); //This should be compatible to 7th parameter of SysListPanelRelationTableCallback in init method listPanel.parmRelationRangeRecId(HcmWorker.RecId); listPanel.fill(); break; } } C. Tab change Copy paste below code in tabChanged method to call above method every time when the user changes the tab. [Control("Tab")] class Tab { public void tabChanged(int _fromTab, int _toTab) { super(_fromTab, _toTab); element.tabChanged(_fromTab, _toTab); } } That's it, you just created a very simple list panel control with minimal coding. Cheers!!! Harry
发表我的评论
取消评论

表情

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

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