Application Object RunOn Property Overview
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
In Microsoft Dynamics AX, application objects such as reports, tables, and methods can run on the application object server (AOS) or the client. An object can also have the RunOn property value set to Called from. Objects set to Called from can run from either the client or server, depending on where the object is called from. This topic describes the RunOn property, tiers that class objects can run on, and hints about using AOSRunMode.
Application Object Tiers
The following table describes tiers that application objects run on.
Object |
RunOn property |
Comments |
---|---|---|
Class |
Client Server Called from |
Specify the tier by setting the class RunOn property. |
Class instance method |
Client Server Called from |
The RunOn property value is the same as the class. |
Class static method |
Client Server Called from |
You can override the RunOn property value by using server or client modifiers in the method declaration. For more information, see How to: Run a Class on the AOS. |
Form |
Client |
|
Report |
Called from |
|
Table |
Called from |
|
Table instance method |
Called from |
|
Table static method |
Called from |
|
Table kernel method (update, insert, and so on) |
Called from (unless overridden) |
You can override the table Called from RunOn property value by using server or client modifiers in the method declaration. |
Job |
Client |
AOSRunMode Hints
The RunOn property value Called from is the default value for a class. It is a best practice to document that a method should run as Called from by including the following AOSRunMode hint above the code for the method.
//AOSRunMode::CalledFrom
The AOSRunMode hint helps to determine whether methods on the class are set to Called from by design or because you have not decided which tier the method should run on.
A best practice warning is generated if a method set to client makes a call to the AOS, or a method set to server makes a call to the client. If this call is required, you can suppress the best practice warning by using an AOSRunMode hint, as shown in the following code example.
// AOSRunMode:: <tier>
The value of <tier> can be server, client, or calledFrom and set to the same RunOn property value as the method. For example, a main method that runs on the server and needs to make a call to the client could use the following code.
// AOSRunMode::server.
public static server void main (Args args)
{
// ToDo Add method code here.
}
A best practice warning is generated if the AOSRunMode hint tier does not match the method tier, as shown in the following code example.
// AOSRunMode::client.
public static server void main (Args args)
{
// ToDo Change the AOSRunMode hint to server.
}
See also
How to: Run a Class on the AOS
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.