Sunday, February 19, 2017

How to get current user information using x++ in D365 F&O | AX 2012

The code below will help out in fetching current user Information in D365 FO using X++.

class getCurrentUserInfo
{      
    /// <summary>
    /// this method used to get current user detail
    /// </summary>
    /// <param name = "_args">The specified arguments.</param>
    public static void main(Args _args)
    {  
        info(strfmt("Current User - %1",curUserId()));    
        info(strfmt("User Account Type - %1",xUserInfo::find(false,curUserId()).accountType));  
    }

}

Output will look something like this:






THANK YOU






2 comments: