Call Login Screen using code

omardomard Member Posts: 20
Hi All

We have a client who requested to insert a logout button in a particular screen. Can anyone give me some ideas of how I can logout the current user and display the login screen using code (without using sendkeys)?

Thanks

Omar
PS: tried using companyclose but I did not manage either
let's navigate!

Comments

  • nunomaianunomaia Member Posts: 1,153
    To logout current user you could kill current session. To display login screen again I don’t see any way to archive that.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • krikikriki Member, Moderator Posts: 9,110
    You can't kill your own session.

    So best way is with sendkeys (with all its problems that can occur).

    An even better way is to NOT do it. Why does the user need it? Is he so lazy?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • nunomaianunomaia Member Posts: 1,153
    kriki wrote:
    You can't kill your own session.

    So best way is with sendkeys (with all its problems that can occur).

    An even better way is to NOT do it. Why does the user need it? Is he so lazy?

    With SQL you can kill even your own session :mrgreen:
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • SavatageSavatage Member Posts: 7,142
    kriki wrote:
    Why does the user need it? Is he so lazy?

    Clicking that [X] can be a real bitch sometimes :lol:

    nothing better than a nice sendkeys :mrgreen:
    100 ESC (just to be sure)
    Alt-F
    X
  • krikikriki Member, Moderator Posts: 9,110
    nunomaia wrote:
    kriki wrote:
    You can't kill your own session.

    So best way is with sendkeys (with all its problems that can occur).

    An even better way is to NOT do it. Why does the user need it? Is he so lazy?

    With SQL you can kill even your own session :mrgreen:
    I tried and got the message I can't kill my own session.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • nunomaianunomaia Member Posts: 1,153
    If you use SQL Server command "KILL SessionID" you are opening a new session and not using existing.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • krikikriki Member, Moderator Posts: 9,110
    nunomaia wrote:
    If you use SQL Server command "KILL SessionID" you are opening a new session and not using existing.
    I tried through the Navision Sessions table and also in SQL while viewing all sessions.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • garakgarak Member Posts: 3,263
    with
    kill SEssionID
    
    you can kill you own session.
    Under Navision it is not possible (only with using ADO -> and then Kill)
    Do you make it right, it works too!
  • nunomaianunomaia Member Posts: 1,153
    kriki wrote:
    nunomaia wrote:
    If you use SQL Server command "KILL SessionID" you are opening a new session and not using existing.
    I tried through the Navision Sessions table and also in SQL while viewing all sessions.

    Sorry for explaining me incorrectly. I was talking about using ADO and using SQL command kill. Using ADO you will have a new session ID.
    Nuno Maia

    Freelance Dynamics AX
    Blog : http://axnmaia.wordpress.com/
  • omardomard Member Posts: 20
    Thanks for your comments guys. seems like sendkeys is the only option

    the reason why we need this button is that the client will be placing Navision in a dispatch area where salesmen are required to fill a sales order (which looks like a POS screen). When ready, the salesmen are required to click a LOGOUT button and basically Nav must logout the user and display a login screen for the next salesperson to login and enter his order. Using the red X is not user friendly in terms that the next user needs to manually click on the company to login (eg. File, Company, Open, or File and select company).

    We managed to achieve this scenario using sendkeys but we were seeking something better
    let's navigate!
  • Revolution1210Revolution1210 Member Posts: 161
    edited 2008-07-15
    omard wrote:
    Thanks for your comments guys. seems like sendkeys is the only option

    the reason why we need this button is that the client will be placing Navision in a dispatch area where salesmen are required to fill a sales order (which looks like a POS screen). When ready, the salesmen are required to click a LOGOUT button and basically Nav must logout the user and display a login screen for the next salesperson to login and enter his order. Using the red X is not user friendly in terms that the next user needs to manually click on the company to login (eg. File, Company, Open, or File and select company).

    We managed to achieve this scenario using sendkeys but we were seeking something better

    ...or you could leave NAV logged in under one user, WAREHOUSE for example, setup with the relevant permission, and utilize Salesperson Codes on your orders. Just a thought....
    Ian

    www.NextEqualZero.com
    A technical eye on Dynamics NAV
  • matttraxmatttrax Member Posts: 2,309
    Why not have a table with a separate ID and Password? Link that to a specific USERID and make them login through that new table / form? Then just keep one generic user logged on all the time.

    You might have to change a little code if you are storing USERID in any other fields so it doesn't pull the generic USERID, but it would work.

    We built a timeclock once that basically did the same thing. Clock in and out when you get in, go to lunch, etc. It was for people who didn't really need access to Navision all the time.
  • kinekine Member Posts: 12,562
    I am using the sendkey and working without problems... just sending something like:

    "File-Database-Close;File-1" to close connection and open last opened company again... but be prepared for multilanguage and use the correct shortcuts... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • omardomard Member Posts: 20
    thanks kine

    thats exactly what we are doing... our concern was in case the company "1" shortcut changes to a different company and therefore the prompted login screen would log the user to a different company than the one expected

    thanks to all for the posts
    let's navigate!
Sign In or Register to comment.