Warning: Creating default object from empty value in C:\xampp\htdocs\maziktech\wp-content\themes\salient\nectar\redux-framework\ReduxCore\inc\class.redux_filesystem.php on line 29
Microsoft Dynamics AX 2012:Simple Use of SysOperation Framework: Part 1:DataContract - Mazik Tech Solutions

Hi All,
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

  1. DataContract and Service Creation
  2. Attribute based Customization and Code base Customization via UI Builder
  3. SysOperationServiceController

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)

  1. Create FirstName and LastName fields and make them MANDATORY
  2. A check box  whether to ask if he/she wants to enter the date of birth or not
  3. DateOfBirth field should be enabled/disabled based on the above check box
  4. DateOfBirth value should be defaulted to system date +2
  5. Query field for Vendor Account
  6. Query field should be defaulted to ’3002′
  7. All fields apart from Query field should be group in to ‘Personal Info’ group
  8. Age should not be exceeded with 65 ,otherwise it should prompt
  9. 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 .
For DataContract
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

3
  • Facebook
  • LinkedIn
  • Twitter
4
  • Facebook
  • LinkedIn
  • Twitter
5
  • Facebook
  • LinkedIn
  • Twitter
6
  • Facebook
  • LinkedIn
  • Twitter
7
  • Facebook
  • LinkedIn
  • Twitter
8
  • Facebook
  • LinkedIn
  • Twitter

Note things here:

  1. 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.
  2. Also i have created same number of parm methods as same number of fields in the dialog above in the first screen
  3. 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.

  1. 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
10
  • Facebook
  • LinkedIn
  • Twitter

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
11
  • Facebook
  • LinkedIn
  • Twitter

  1. 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’
13
  • Facebook
  • LinkedIn
  • Twitter

Assign our service to Service group
14
  • Facebook
  • LinkedIn
  • Twitter

Right click the group and click deploy

  1. Deploy the service group

  1. 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 :
17
  • Facebook
  • LinkedIn
  • Twitter

Please let me know for any queries so far

Leave a Reply

PHP Code Snippets Powered By : XYZScripts.com