NAV2013 Session List Changes
In this post just a few tips and tricks I did myself, which might just interest you
In the old days we got a few debugger/session options from NAV. We could even move some parts of the debugger to our liking. Today, this is a completely different story. The Session List and Debugger Page our actual pages, which can be changed however we feel like. All debugger code is now available as C/AL commands also…
Yesterday I made a few changes in the NAV2013 Session List Page to show me a few options I was missing:
– Kill Session
– Session Execution Mode
– Session Company Name
The first is actually a very easy feature to add. We now have a new command which is called “STOPSESSION”. All you need to do is edit the Session List Page (9506) and add an action called “Kill Session” (or whatever name you like). In the action just call the following line:
STOPSESSION("Session ID")
“Session ID” is a field in the table “Active Session”. This table is maintained by the Service Tier.
A few notes:
– STOPSESSION only works on the service you are connected on, so not on another service tier.
– STOPSESSION accepts a second parameter “Comment” which will be logged in the “Session Event” table.
– You might also want to add a confirm before the STOPSESSION
At Ifacto, we are currently in the process of putting our add-on into NAV2013, but starting from scratch in the mean time. Sometimes we need to debug, sometimes we have sessions hanging (yes it happens).
So you see, the kill session will already come in handy. But what if you have a normal session open, and a debug session which was left hanging. Which do you kill? Sometimes it might seem fun to play Russian roulette, but most of the time it basically annoying. Luckily NAV now also has a command “CURRENTEXECUTIONMODE” which can be Standard or Debug. But as the command is called current, you have no information over the execution mode of another users session. Just as you do not know the Company Name the user is running in. I already mentioned the “Active Session” Table is maintained by the Service Tier, by code which is sadly not manageable by us.
To get by this problem, I created a new table with the primary key being Server Instance ID, Session ID (the same as the Active Session) and adding some more informational fields out of it. In the Codeunit “LogIn Management” I wrote some code after the “LoginStart” function to fill up this table. Now I can easily fetch this information in the Session List page. Again a few notes about this:
1. I did not change the “Active Session” table for a few reasons:
– It’s a 2000000xxx table which is automatically added by NAV. It is always safer not to touch those.
– I did however try to change it, but as soon as you start your Window Client, you get a nice SQL error about not being able to insert NULL values. You would probably need to restart the service tier for it to work.
2. I do not care about removing the records (for now). I overwrite them in the LoginStart Function if necessary. They are only shown if there is an active session with that ID.
3. I created the Execution Mode field as an option: “Unknown, Standard, Debug” which I fill through the following code:
if evaluate(MyField,Format(CurrentExecutionMode)) then;
Why?
– ExecutionMode is not a text nor integer, it’s a special type
– I can maintain the default type Unknown for when new Execution Modes are created without running into errors.
In the Session List page, I can simply do a get on the new table with the “SERVICEINSTANCEID” property (you only see sessions of your own service tier in the list anyway – unless you should change the code) and the Session ID of the Active Session to get the record and show the Company Name & Execution Mode of that session. Older Sessions will be shown without a Company Name and Execution Mode Unknown.
So… These are just my 2 cents on changing the Session List Page. With the information above, you could add any local session information to the informational table (GuiAllowed, LanguageID, …….)
Let us know your ideas and/or groundbreaking tricks to change this page in the comments below.
As always, have fun
Edit: Don’t forget to put the new table as DataPerCompany=No!
*This post is locked for comments