Specify Which Tier an Object Should Run On

Application objects (reports, tables, methods, and so on) can be run from the server or from the client. An object can also be set to run as "called from." It can run from either tier, depending on where it is called from.

NoteNote

At the time of publication, portions of this topic were intentionally left blank. For the most current information, visit Microsoft Dynamics AX Online.


The following table specifies which tier an object can run on.

Object

Possible tier(s)

Comments

Class

Client, server, or called from

Tier is specified by using the class RunOn property (set to Client, Server, or Called from).

Class instance method

Client, server, or called from

The value is the same as that for the class.

Class static method

Client, server, or called from

The value set for the class can be overridden by using the server or client method modifiers.

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

The value set for the table (called from) can be overridden by using the server or client method modifiers.

Job

Client

If a method bound to the client makes a call to the server (or the server makes a call to the client), it causes a best practices warning. Warning icon For cases where the call to another tier is necessary, you can suppress the warning by using an AOSRunMode hint.

To suppress a best practices warning caused by a method on one tier calling the other tier, write a comment above the code for the method. Use the following format.

// AOSRunMode:: Tier

Where Tier can be server, client, or calledFrom. The value of Tier must be the same tier-setting the method is executing on.

For example, if you have a main method that runs on the server and it needs to make a call to the client, you would write the following.

// AOSRunMode::server.

public static server void main (Args args)

{

// Method contents here.

}

The AOSRunMode hint must match the tier the method is bound to. For example, if you write the following, you will get a best practices error Error icon.

// AOSRunMode::client.

public static server void main (Args args)

{

}

Document Decisions about Called From

Called from is the default value for the RunOn property for a class. It is not possible to determine whether methods on the class are set to Called from by design, or because the developer has not yet decided which tier they should run on.

It is best practice to document your decision that a method should run as Called from by including the following AOSRunMode hint above the code for the method:

//AOSRunMode::CalledFrom

Community Additions

ADD
Show: