Monday, December 4, 2017

AX - How get info about AX user

When you need info about connected user, you can use class UserInfo and xUserInfo:
UserInfo userInfo = xUserInfo::find( false, curUserId() );
    
if ( userInfo ) {
  info( "Name: " + userInfo.name );        
  info( "Language: " + userInfo.language );
  info( "Enabled: " + ( userInfo.enable ? "Yes" : "No" ) );
}
Output:
Name: Aldiss, Brian
Language: en-us
Enabled: Yes
Note: For current user you can use directly:
UserInfo userInfo = xUserInfo::find();

No comments:

Post a Comment