Nav User : In which company is currently logged in

bergoullebergoulle Member Posts: 23
Hi experts,

i was wondering if there is a way to found the company name a user is currently logged in.(Without asking him ...)


thank's

Comments

  • DenSterDenSter Member Posts: 8,304
    There's a system variable COMPANYNAME that holds the current company.
  • bergoullebergoulle Member Posts: 23
    The "COMPANYNAME", Isn't located on his own station ?
  • bergoullebergoulle Member Posts: 23
    bergoulle wrote:
    The "COMPANYNAME", Isn't located on his own station ?
    Without storing Users COMPANYNAME Value, do you think there are other ways ?
  • David_SingletonDavid_Singleton Member Posts: 5,479
    bergoulle wrote:
    bergoulle wrote:
    The "COMPANYNAME", Isn't located on his own station ?
    Without storing Users COMPANYNAME Value, do you think there are other ways ?

    Actually I have always believed that table 51 should have Companyname as a part of the primary key. Maybe you could copy that table to a new one with company name. But I wouldn't mess with the primary key of a standard table.
    David Singleton
  • ara3nara3n Member Posts: 9,256
    you can add a field to user setup. On login, you can loop through all companies and update the company name in the user setup.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • DenSterDenSter Member Posts: 8,304
    bergoulle wrote:
    bergoulle wrote:
    The "COMPANYNAME", Isn't located on his own station ?
    Without storing Users COMPANYNAME Value, do you think there are other ways ?
    Why would you not want to use COMPANYNAME? It is exactly what you're looking for. :-k
  • David_SingletonDavid_Singleton Member Posts: 5,479
    Actually most post above is nonsense, since Company name IS a part of the primary key, so it can be used. Just add the field Currently Logged In::Boolean and update this in code unit 1.

    Its not a 100% solution, since there are a number of situations when it will give incorrect information, but if its just something to get a general over view it will work fine. The advantage of T51 over T91 is that there is much less to modify, since its already modified in CU1, and also if the client crashes, then its fixed the next log in anyway without any clean up loops. But as Rashed says you can also use T91.
    David Singleton
Sign In or Register to comment.