Microsoft Dynamics AX 2012:Simple Use of SysOperation Framework: Part 1:DataContract

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

1

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

dataContract

age DateOFBirth Fname IsDateEnter Lname query

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.

serivicegeneraion

now the Method ,that will be my ‘service operation’  means that will actually perform the task

operaionMethod

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

RunOnServer

  1. Create a Service and associate our service class to it

AsimSerive

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’

Operation

  1. Assign our service to Service group

AxClientGroup

Right click the group and click deploy

  1. Deploy the service group

DeployOnfolog

  1. Create a menu item to interact with the dialog

MenuItem1

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 :

Par1

So stay tuned for the next part 🙂

Please let me know for any queries so far

Advertisements

10 responses to “Microsoft Dynamics AX 2012:Simple Use of SysOperation Framework: Part 1:DataContract

  1. Pingback: Microsoft Dynamics AX 2012:Simple Use of SysOperation Framework:Part 3:SysOperationServiceController class « amazingAX·

  2. nice post Asim!

    Could you explain a bit more the use of implementing separate service class or the service class itself for sysOperation framework. Cant we do without it? just want to know the importance of it..

    Thanks,
    piku

  3. Hi
    How to create the form by using the sysopertion framework here my requirement is if i click the menu item i want to open the dialog according t the dialog inputs display the data.
    Data is comming from different tables.in my form i created a temp table i want to display the data through temp table.it is possible?

    regards
    ramesh

    • Thanks, yes we can achieve this, can you please go over the class “PurchRFQFormLetter”, it has the dialog /controller class to addressed the some what same requirement. Do let me know if it is still unclear

  4. very helpfull. but a can not do deploy of the service group. can i go on with the exercise anyway? thnxx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s