Get full domain userid

ayashiayashi Member Posts: 78
edited 2007-11-22 in NAV Tips & Tricks
How to get full domain name and login ? If the login information is DOMAIN\john, the USERID field only return the value of "john" instead of full login information "DOMAIN\john".

I need this function because I created a user authorization table which consist of windows login user (the customer use windows authentication), my table keeps the record of login which is a completed information "DOMAIN\john" (lookup from windows login table), when it comes to user comparison, the system can't find if the user actually exists on the table, because USERID command only return "john".

Answers

  • kinekine Member Posts: 12,562
    Try to use automation "'Windows Script Host Object Model'.WshNetwork" for getting more info about the logged user. (UserName and UserDomain properties).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • ayashiayashi Member Posts: 78
    thank kine, you're right, using automation, I could retrieve the domain and user name, then combine it using '/' \:D/ thanks a lot
  • krikikriki Member, Moderator Posts: 9,112
    [Topic moved from Navision forum to Navision Tips & Tricks forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ara3nara3n Member Posts: 9,256
    message(environ('USERDOMAIN') + '\' + USERID) ;

    Should give you the information as well.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • krikikriki Member, Moderator Posts: 9,112
    ara3n wrote:
    message(environ('USERDOMAIN') + '\' + USERID) ;

    Should give you the information as well.
    better:
    message('%1',environ('USERDOMAIN') + '\' + USERID);
    
    Otherwise the \ is interpreted as a carriage return-line feed.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.