Microsoft Dynamics AX Support

This blog contains posts by the Microsoft Dynamics AX Support teams Worldwide

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

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

Rate This
  • Comments 1

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.

Leave a Comment
  • Please add 4 and 3 and type the answer here:
  • Post
  • Thanks for this clear explanation.

Page 1 of 1 (1 items)