Is there any way to do this in 5.0?
I was able to do this in 3.7 by running the following code prior to closing Form 330 (Main Menu):
Form - OnQueryCloseForm() : Boolean
IF NOT CONFIRM('Are you sure you want to close your connection to the Navision Database?',FALSE)THEN
ERROR('');
Although closing Form 330 didn't really 'close the database', the users didn't know any different, and they could 'opt out' of closing Navision prematurely.
In 5.0, I tried the CompanyClose() and LogInEnd() triggers in CodeUnit 1 (ApplicationManagement) with no success.
Does anyone have any idea how I might achieve this?
It is far too easy to accidentally close the application.
Thanks in advance,
headley27
0
Comments
Seriously, I don't think there is much you can do, certainly in terms of injecting code into codeunit 1.
NAV is no different to any other Windows app in terms of users accidently closing down... ..what's the worse that can happen? they have to restart the client.
www.NextEqualZero.com
A technical eye on Dynamics NAV
I'll use CodeUnit 1 (ApplicationManagement) to launch a Custom Form that is not visible.
This form will contain the code that presents the choice to the user, allowing the user to stop the application from closing:
Form - OnQueryCloseForm() : Boolean
IF NOT CONFIRM('Are you sure you want to close your connection to the Navision Database?',FALSE)THEN
ERROR('');
...but I'm pretty sure your solution will cause navsion to GPF if you call it from CompanyClose() or LogInEnd()... ..i could be wrong
www.NextEqualZero.com
A technical eye on Dynamics NAV
The Terminal Server that they access is locked down to the point that Navision opens by default without a desktop, taskbar, etc. and only applications launched by Navision can be used.
When the user closes Navision it closes the session on the Terminal Server. Logging back in takes a little time so the code I used in 3.7 made everyone happy. This included local users who didn't like that Navision could be accidentally shut down with a missed mouse click and as a result, would force them to relaunch Navision and all of their open forms, etc.
The CompanyClose() and LogInEnd() are only called if the User clicks 'Yes' to the confirmation message allowing 'Navision to close'. If the User clicks 'No' the hidden form doesn't close, spawns a silent error, and effectively stops the application from closing.