How to disable logins in Navision

c.kestasc.kestas Member Posts: 15
Does anybody have any idea on how to disable logins in Navision?

What I'm trying to do is this:
Every morning a batch job runs under NAS and if the job runs into problems I want to stop ordinary users from loging in until the problem is resolved. I have no problem identifying the fact that the job did not finish correctly or distinguishing ordinary from priviledged users. The question is how do I stop a user from loging in. Or perhaps force read-only mode?

I know the answeris in Codeunit 1, function CompanyOpen, but then what? An error there will simply stop the execution of the trigger but the user will log in anyway? I tried deleting the session record of the current user but it wouldn't let me.

Any Ideas?
thanks

Answers

  • ara3nara3n Member Posts: 9,257
    Put code that will loop until they are allowed to login. Something like this

    REPEAT
      IF CONFIRM('You cannot login, because blah. Do you want to check if you want to get into navision?') THEN
        EXIT;
    UNTIL allowedToLogin;
    


    allowedToLogin would be a function that will check a table for your criteria and return a true or false.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You could try to use SendKeys to simulate some keystrokes to exit Navision. Have a look at this thread: Terminating Navision
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • vytjakvytjak Member Posts: 36
    If you are using Nav DB logins, you could try temporary setting "Expiration Date" to the past in "User" table.
    Vytenis Jakas
    B3 Technologies - Making Technology Serve the People
  • c.kestasc.kestas Member Posts: 15
    Thanks guys.

    The SendKeys worked beautifully. The expiry date is also a good idea.
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Please modify the subject of your initial message by adding [SOLVED] in front of it.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Sign In or Register to comment.