Skip to main content
Dynamics 365
<1 min read

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

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.