Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

User security ID

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi All,

I want to get information from table User Group Members.

I defined a record variable (UserGroupMember) for this table and try the next function:

UserGroupMember.GET('VERKOPERS',SID(USERID),COMPANYNAME)

This give me an error:

Invalid form of GUID string

Any help is welcome,

Thanks,

Patrick

 

 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: User security ID

    Saurav,

    You're right. I was confused that USERID had only to do with windows account.

    Everything is working now.

    Thanks,

    Patrick

  • Suggested answer
    4BzSoftware Profile Picture
    4BzSoftware 6,071 on at
    RE: User security ID

    Hi Patrick,

    Is it what you need?

    //gRec_User is record variable, table 2000000120 - User:

    IF gRec_User.GET(USERSECURITYID) THEN

     MESSAGE('%1 %2', gRec_User."User Name", gRec_User."Full Name");

  • Verified answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 14,178 Super User 2024 Season 2 on at
    RE: User security ID

    Hi,

    When You User USERID, Your get the User Name that is in the User table.

    Read C/AL Help for USERID, it says so.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: User security ID

    Suarav,

    I think this will solve the problem but I have one more question.

    How do I get YourUserName: the name of the user currently logged in?

    Thanks,

    Patrick

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 14,178 Super User 2024 Season 2 on at
    RE: User security ID

    In That Case You Cannot use SID(UserID).

    Then Try This -

    User1.Setrange("user Name",YourUserName);

    IF User1.FindFirst Then

    UserGroupMember.GET('VERKOPERS',User1."User Security ID",COMPANYNAME)

    Where User1 - is a variable of Table 2000000120.

    and YourUserName - is the Username that you have given While Creating User.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: User security ID

    Saurav,

    It's not a windows user. So I think I cannot use this function?

    User1.Setrange("Windows Security ID",SID(USERID));

    Thanks,

    Patrick

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 14,178 Super User 2024 Season 2 on at
    RE: User security ID

    Hi Patrick,

    Try This -

    User1.Setrange("Windows Security ID",SID(USERID));

    IF User1.FindFirst Then

    UserGroupMember.GET('VERKOPERS',User1."User Security ID",COMPANYNAME)

    Where User1 - is a variable of Table 2000000120.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: User security ID

    Hi Saurav,

    Ok.  But how do I get the information I need?

    In need the User Security ID of the current user.

    With that I can query table User Group Members.

    Thanks,

    Patrick

  • Suggested answer
    Saurav.Dhyani Profile Picture
    Saurav.Dhyani 14,178 Super User 2024 Season 2 on at
    RE: User security ID

    Hi,

    The Result of SID(USERID) will get the Windows Security ID but

    what the Table User Group Member is Looking a Different Security ID which was automatically Generated When you create a New User.

    ** The Field is Mapped To User Table (2000000120) Field - User Security ID.

    I hope you understand my point. You are trying to assign Wrong Value in Get Statement.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: User security ID

    9001

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans