63) Add a Menu Item to a SysOperation dialog - D365

 A short one! Some time ago I explained how to add a multi selection lookup to a SysOperation dialog and in this post I’ll explain how to add a Menu Item as a Function button to the SysOperation dialog.

Before the SysOperation Framework was introduced in AX2012, we used the RunBase Framework, and maybe doing these things looked easier/quickier with RunBase because all the logic was in a single class. But in the end what we need to do is practically the same but we have to do it in the UIBuilder class.

Let me show you and explain all the code. I’ll only show the DataContract and UIBuilder classes as they’re the only important ones in this case.

DataContract class

Please don’t look at all the hardcoding 😛

On the DataContract class I’ve defined a VendAccount member. I’ve also created a group using the SysOperationGroup attribute and put the VendAccount field inside using the SysOperationGroupMember attribute in the parm method.

The UIBuilder class is also set in the SysOperationContractProcessing attribute.

UIBuilder class

All the things we need to do to modify the dialog of the SysOperation Framework must be done in the UIBuilder class. What we need to is the same we would have done using the RunBase framework. Get the controls from the dialog and modify or add its elements.

We get the vendor group we created in the Data Contract class and add a control to it. This control is of type MenuFunctionButton and once it’s created we define it’s properties and it’s done.

Add a Menu Item to a SysOperation dialog 1
A Menu Item button in a SysOperation dialog!

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++