setPrefix Function [AX 2012]

Updated: December 10, 2009

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Sets the prefix for the current execution scope.


int setPrefix(str _prefix)

Parameter

Description

_prefix

The prefix for the current execution scope.

0 if the prefix was set successfully.

The complete prefix for the execution can be fetched by using the getPrefix function. When leaving the scope, the prefix is automatically reset to the previous level. The prefix mechanism makes it more straightforward to write precise error messages about the transactions performed by an application.

Suppose the AA method calls the BB method, and each method calls this function. Messages written to the Infolog by the BB method appear nested in a hierarchy. When the BB method ends and control returns to the AA method, the prefix that was set by the BB method is not attached to subsequent messages.

static void setPrefixExample(Args _arg)
{
    int i;
    ;
    i = setPrefix("Prefix");
    print i;
    pause;
}

Announcements: To see known issues and recent fixes, use Issue search in Microsoft Dynamics Lifecycle Services (LCS).

Community Additions

ADD
Show: