Today on forums was out this question: how to disable access to Microsoft Dynamics NAV Web Client for specific users?
Unfortunately there’s no a native function for disabling a user to access the NAV system with a specific client type (web, mobile, tablet and so on), but this can be easily handled with a customization. My suggested way (valid also for Extensions) is to create an Event Subscriber to the OnBeforeCompanyOpen event in codeunit 1 (ApplicationManagement). Here you can check the Microsoft Dynamics NAV client type that is running in current session and determine if it’s a valid client type for the user.
Create a custom codeunit and here create a function CheckUserClientType with these properties:
The code for this function is as follows:
Obviously, you need a place to store the settings for each user regarding the Client types that he can’t access (this sample checks for web client because this was the question, but we can check for Tablet and all the other supported client types). Here, I’ve choose to use the User Setup table (I have a boolean field for disabling a certain type of client).
This is the unique way to do this using the actually available events. Another proposed solution was to use the LogInStart function in codeunit 40 (LogInManagement) but I’ve discovered that (if you want to use this function) an event is missing. Here, NAV expose only an OnAfterLogInStart event and we don’t have an OnBeforeLogInStart event available.
For this specific task, my recommendation is to use the suggested way. However, I think that an OnBeforeLogInStart event could be useful to have for certain scenarios (it costs nothing to add it). Its natural place could be here:
A request to add it is placed.
P.S. Don’t to this with Dynamics 365 Business Central 😉