Book Image

Microsoft Dynamics AX 2012 R2 Services

Book Image

Microsoft Dynamics AX 2012 R2 Services

Overview of this book

Table of Contents (17 chapters)
Microsoft Dynamics AX 2012 R2 Services
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Custom controllers


In the earlier example, we used the SysOperationServiceController class on our menu item to run the services. This is the base controller, but you can create your own controller when there is the need. In this part, we will first take a look at some of the scenarios in which custom controllers can be used, after which, we will create a custom controller.

Usage scenarios

What follows are two of the most common scenarios in which you would use a class that extends SysOperationServiceController. The first is using a controller to initialize a data contract and the second is a scenario in which you override methods of the dialog fields.

Initializing the data contract

A controller can be used to initialize the data in the data contract. This is one of the most common scenarios in which a controller is used and is the scenario that we will demonstrate further on in this chapter. Initializing a data contract is usually done based on the Args object.

The Args object contains information...