Tuesday, July 17, 2012

Microsoft Dynamics AX Retail 2012 - Blank Operations



Hi There,

I hope everybody had a restful weekend and that you are ready for another creative and challenging Microsoft Dynamic AX week.

On this post I would like to take a look at how the Blank Operations work in Microsoft Dynamics AX 2012 Retail. Please note that there is a lot to cover under this topic, and I hope that what I’m covering here today can help you get started on creating your own customizations for AX 2012 POS in no time.

So, what are Blank Operations? Well, Blank Operations, in my opinion, are the fastest and easiest way to extend the AX for Retail POS application. In addition, Blank Operations can be assigned to a button action right in the Retail POS till layout, and the great thing about them is that we can deploy as many of them as we need, which makes Blank Operations very flexible.

When we create a new project in Visual Studio and use the Blank Operations namespace, we are actually overwriting an existing DLL that exists within the AX 2012 POS application folder (located in C:\Program Files (86)\Microsoft Dynamics AX\60\Retail POS\Services).



Within this DLL we can write simple and/or complex logic to achieve different business requirements. Further,  one of the greatest advantages of Blank Operations is that they don’t really touch the core AX 2012 Retail POS logic and therefore they are safe to play around with and extremely easy to deploy.

So let’s start by creating a new Project in Visual Studio and then let’s create a form that then we will hook up to a Blank Operation in our Retail POS till layout.


1-Create a new project in Visual Studio and call it BlankOperations. By default, the namespace will be BlankOperations as well.

In here add the following code:


  

2-Add the following references to your project by right clicking your References folder. (For more information on how to do this please AX 2012 POS Development - Application Triggers)




3-Set your project’s properties to build the dll into the desired folder (C:\Program Files (86)\Microsoft Dynamics AX\60\Retail POS\Services – for more information please see AX 2012 POS Development - Application Triggers)

4-Now let’s create another new project (class library), call it MyForms, and then add a form to it, and call it MyBlankOperation. You will have to set the build properties for this project the same way you did it on the previous step. However, just set the path to C:\Program Files (86)\Microsoft Dynamics AX\60\Retail POS so the MyForm project dll will exist in the root of the AX Retail POS.





Add a label to the form and build the solution.

 




5-Build the solution

6-Go to your BlankOperations project and right click references and browse to C:\Program Files (86)\Microsoft Dynamics AX\60\Retail POS and look for the MyForm.dll. Then add the reference to your code (i.e. using MyForm;)

7-Open your AX 2012 POS Retail and on the edge of the screen right-click and choose “Customize Layout



8-From the designer (hidden items) drag a button to a place in the till layout.



9-Choose whether or not you want to save the changes (If you just want to test it, you can say no and the next time you open the layout it would be stay as the original one)



10-Right-Click on the area you just created and choose New Button Grid



11-Fill out the necessary information as per the picture below and when you are done click Confirm.



12-Right-Click  on the area you just created and choose Open Button Grid



13-From the dialog box click the Button Grid drop down list and choose BlankOp, which is the name we gave to our button in step 10.



14-From the Action pane click the Item drop down list and choose Blank Operation. Then fill the information as per the picture below.



15-Now you should have a button in your till layout. Click it and you’ll see the form we created before in this tutorial.



Note that you can have many buttons with different ids that can be manipulated later in your code by an operation ID. As you can see, Blank Operations are easy to implement and deploy, and most importantly they can help you create your own custom logic without affecting the AX 2012 POS core logic, which is nice.

Well folks, this is all for now and I hope this can help you get started on Blank Operations.

Also, keep reading my blog as I will be posting and overview of the deployment process in AX 2012 and much more in the coming days.


4 comments:

  1. Great post. It's an easy way to open the door to many possibilities on the POS. Easily deploy-able and course doesn't impact the AX code base. I'm curious to see how adding new forms could work, since I run into screen space issues all the time.

    ReplyDelete
    Replies
    1. Hi Stash,

      Do you mean addign new windows forms, correct? If so, you do this via Visual Studio and instantiate them in your code. Perhaps this post (http://axwonders.blogspot.com/2012/06/ax-2012-for-retail-introduction-to.html) can clear the doubts.

      Let me know if I'm answering your question though. If not, please give me an example to better understand how to help you out : )

      Delete
  2. hei, what is System.Setting.Dll? where can i get it? x)

    ReplyDelete
    Replies
    1. Hi Samuel,

      This dll should exists in the POS folder.

      Thanks!

      Delete

Thank you for your thoughts. Your comment will appear in my blog shortly after review.

Have a great day!