When building business logic in Microsoft Dynamics AX or Dynamics 365 for Finance and Operations, it’s often important to know who the current logged-in user is.
This blog post shows a simple X++ example to fetch the current user ID and user account type at runtime.
curUserId()
This built-in function returns the User ID of the person currently logged into the application.
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


Excellent Topic sir, keep it up.... post more on AX 7
ReplyDeleteThank you
Delete