web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Get User Profile in X++ code

(0) ShareShare
ReportReport
Posted on by

How can i get User Profile ID for the currently logged in user in X++ code in AX 2012?

 User-Profile.png

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    You should consider multiple company accounts since you could have a different profile set per legal entity.
    info((select firstonly ProfileId from SysUserProfiles where SysUserProfiles.UserId == curUserId()).ProfileId);
  • Community Member Profile Picture
    on at

    Hi Vilmos,

    Thanks a lot. Since i am new in AX, could you please provide complete syntax to get user profile id and store it in a string variable? Please note, i need to create this method/file in code behind of a Data Set.

  • Suggested answer
    Chaitanya Golla Profile Picture
    17,225 on at

    Hi,

    Could you provide some more information regarding "create method in code behind of a data set" means.

    Code to save it to a variable:

    ProfileId profileId; // Variable declaration

    select firstonly ProfileId from SysUserProfiles where SysUserProfiles.UserId == curUserId();

    ProfileId = SysUserProfiles.ProfileId;

    Thanks,

    Chaitanya

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You would replace the info method call with a variable assignment instead. Find the Extended Data Type behind the field in the table mentioned above, and use that as the variable.

  • Community Member Profile Picture
    on at

    Thank you. I have achieved my requirement.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans