Search code examples
axaptax++dynamics-ax-2009

How am I sure that my process has a user interface?


When running a class which can be used interactively or silently by batch, I want to display a hourglass, only if in interactive mode.

I found the function xGlobal::clientKind() , read below, but not sure it is sufficient (can't batches also run on Client ?)

if (xGlobal::clientKind() == ClientType::Client)
    startLengthyOperation();

// here do the process

if (xGlobal::clientKind() == ClientType::Client)
    endLengthyOperation();

Solution

  • Do not bother to test client kind when using startLengthyOperation, the method does a sufficient test itself.

    Testing should be like this:

    if (clientKind() == ClientType::Client)
        ...
    

    Don't use xGlobal::clientKind, use without qualification.

    The ClientType has four values, matching what you see in "Online Users".

    Batch can be called interactively in Basic/Periodic/Batch, but it should be rarely used.