RSS

How to Identify the Tier X++ Code is Running On

06 Jan

It can be unclear as to which tier, either the client or the server, X++ code is executed on. This ambiguity can lead to problems. For instance if you run a server-bound batch, all of the code has to run on the server. If a call is attempted on the client this error will be thrown: “The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only.”
You can add statements to your class that will tell you which tier your code is executing on. Add the following to your X++ code:

info(strfmt(“%1”, xGlobal::clientKind()));

The output of this line will be either Client or Server

Advertisements
 
Leave a comment

Posted by on January 6, 2012 in Microsoft Dynamics AX, X++

 

Tags:

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

 
%d bloggers like this: