Recently, I tried to delete a user from a Dynamics NAV 2013 database but got an unexpected error message: “The user cannot be deleted because the user has been logged on to the system. You must set the user’s state to Disabled”.
My first thought was that the user was logged on into the database at that very moment, and that NAV was preventing me from deleting an user with an active session. But when looking into the session list it appeared that the user did not have an active session.
Next thought was that NAV asked me to prevent the user to log in by setting the user state to disabled but that proved to be wrong:
So what to do? Luckily, one of my colleagues knew the trick: delete user personalization.
And yes, after deleting the record for the user from this list, I was able to delete the user record.
This personalization record is created automatically when a user logs in the first time. It is updated each time the user exits the application with the latest used language and company the user was logged in to. So NAV interprets the existence of this record as ‘the user is active’ and prevents you from deleting the user. Not a very informative message, and in my opinion not a very nice design either.
But now you know how work around this message!