This is the Part 1 of series of the explaining the simple use of SysOperation Framework in Ax 2012.
So lets start with the introduction,
SysOperation Framework: SysOperation Framework formerly known as (Business Operation Framework) provides a way to create and run our operations on a batch server. Previously in earlier versions of Ax 2009 RunBaseBatch framework was used.
The only reason that i have understand of the introduction of SysOperation in Ax 2012 is that, in previous version RunBaseBatch provides the implementation of the actions required for the operation to be run on server.But SysOperation provides the BASE implementation of all the implementation that were before.So it means that there is a fair chance of extending in future versions as well.For more information you can MSDN 🙂
Here is the list ,i will be covering as a part of SysOperation Framework in AX 2012
- DataContract and Service Creation
- Attribute based Customization and Code base Customization via UI Builder
So lets start Part 1.
Agenda: User/Developer need to create a something like this (below) as a part of SysOperation Framework
What needs to be in the above dialog:(Requirements)
- Create FirstName and LastName fields and make them MANDATORY
- A check box whether to ask if he/she wants to enter the date of birth or not
- DateOfBirth field should be enabled/disabled based on the above check box
- DateOfBirth value should be defaulted to system date +2
- Query field for Vendor Account
- Query field should be defaulted to ’3002′
- All fields apart from Query field should be group in to ‘Personal Info’ group
- Age should not be exceeded with 65 ,otherwise it should prompt
- Upon successful execution Info log should be prompt ,showing the complete name,date of birth,age and vend account value.
So here it is we have quite few requirements above 🙂 covering all the functionality that i will be covering for the SysOperation Framework .
1. Create a class with any name like ‘AsimDataContract’ declare global variables.Think of all fields of on the dialog and declare variables according to it
here it is
Note things here:
- First i have created a class called AsimDataContract and place an attribute called ‘DataContractAttribute’ so I want to ensure that this class is not a normal class but this class should be use as a Contract class instead then i need to place this attribute on the class level.
- Also i have created same number of parm methods as same number of fields in the dialog above in the first screen
- So if we want to make the fields available on the dialog,i need to create a Parm methods for it and add ‘DataMemberAttribute’ on every methods like i did.
Important thing to do:
After creation of the above class we need to perform several task in order to view the dialog.
- We need to create a service class and use this AsimDataContract class in it.It is a class where we mentioned the actually operation performed by our service.
now the Method ,that will be my ‘service operation’ means that will actually perform the task
Here ‘SysEntryPointAttribute’ is used on the method,which make this method as a service operation.Now this method will be taking all the input from the dialog and show the input values in a dialog see the highlighted items which will fairly give you an idea.One thing more,see this method is taking Data Contract instance as an input parameter.Finally we need to set the ‘RunOn’ property to ‘server’ otherwise our service wont run
- Create a Service and associate our service class to it
Now when you go to operation node and right click it and try to create/add a new operation the method name containing ‘SysEntryPointAttribute would be available here.In our case it is ‘operation’
Assign our service to Service group
Right click the group and click deploy
- Deploy the service group
- Create a menu item to interact with the dialog
last but not the least we need to generate IL(you can MSDN why we need it) but for service to be run on server we need to generate IL for it.
So far what we have would be something like this :
Please let me know for any queries so far