I imported the objects on a 4.0SP1 native.
First I had the same error as you. Then I recompiled and I got no more errors.
2 things come in mind to test:
1) maybe the codeunit was in memory and after compiling it remained there. If you re-open the client it should take the new version of the codeunit and the problem should be solved.
2) If you have a problem with FINDFIRST, it means you have a client before 4.0SP1. FINDFIRST was introduced with 4.00SP1.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
We are planning to change the NAV partner, ours is %&%&**
I'm learning to control, program and debug my system.
I have a SUPER rol but i can't run some codeunits design some forms...
Any idea? its the license? I cant design even having all access to tables, forms codeunits and so on?
yes you can kill the session also in the native database (>= 4.00)
For test: Open Database -> File -> Database -> Information -> Sessions -> active Sessions -> DrillDown -> SessionList -> F4 to kill a session
The definition of the field User ID was changed after the object was saved
Old type: Text
New type: Code
This is a common error. It's caused because the type of the "User ID" on the virtual table is different between Native and SQL. You have to SAVE the object (normally a form) again, not just recompile from the object designer.
Second minor point, for the F4 kill to work on SQL the user must be a member of the SQL system administrator role with delete permission on the Navision session table. Just being a member of the Navision SUPER group is not enough.
Great job ! Unfortunatelly I'm unable to launch CU because of a error "you can use FINDSET only if keys are acending ordered" (table session).
IF PtmpSession.SETCURRENTKEY("Idle Time") THEN BEGIN
// I am on SQL. SQL has a key on "Idle Time".
PtmpSession.ASCENDING(FALSE);
IF PtmpSession.FINDSET THEN <---- ERROR here
I'm using Nav 4.03 with SQL Server 2005. I'm able to sort on idle time in session form so i think the key is present. So ?
possible bug ? : in FindSessionToDelete you search for DOMAIN\USERID in tmpSessionKillerMaxUserSess table witch contains user ID "modified" by GetUserID (without domain name)
IF ItmpSessionKillerMaxUserSess.GET(PtmpSession."User ID") THEN
IF NOT ItmpSessionKillerMaxUserSess."Never Kill Session" THEN
EXIT(TRUE);
Modified like this and it works for me :
//IF ItmpSessionKillerMaxUserSess.GET(PtmpSession."User ID") THEN
tmpICodeUserID := GetUserID(PtmpSession);
IF ItmpSessionKillerMaxUserSess.GET(tmpICodeUserID) THEN
IF NOT ItmpSessionKillerMaxUserSess."Never Kill Session" THEN
EXIT(TRUE);
I do have the CU 8000 running and the Dashboard Form shows the sessions are checked every N seconds.
My problem is that no sessions are shown in the sessions table and no sessions are killed. Do I need to define the database or company somewhere in the CU?
I'm using NAV 6 with SQL Server and just run the CU out of the client for testing.
I don't know if you still can help me but I'm having trouble with the code unit. I Manage to change the codeunit (FINDSET vs FINDFIRST). I can see all the sessions that are inactive for more than 2 minutes. But no session get kill. I set OptionKill at 1 minutes and the Always Kill at 3 minutes (testing purpose). I can see my test sessions stay there as long as I don't close manually the application. (No user have the "never kill" option)
When I run the manually the code unit It run every x seconds as I ask him to do... but still no killing...
Is there any specific privilege (DB right or roles) I should set on every sessions or only on the account that run the NAS?
2010-08-20 12:51
EDIT: The problem occured only on windows session. Session with SQL logins are killed
It shouldn't be a problem. If DB users are killed, also Windows users should be killed.
Instead of using a NAS, open a client and run the codeunit using the debugger to see what is happening.
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Thanks for the reply, I tried and can't figure out... So I decide to go an other way... A Job that runs on the sql server, it remove the load from the client and give me the possibility to log and do more stuff without taking out Navision object as they are limited in numbers (licence).
I have seen that few C/AL code are written under the Ontimer trigger of the Form Session Killer Sessions (ID = 80002).
Can someone explain How does CurrForm.update(false) work here ???
Actuall, the form does not kill anything. it is a dashboard for doing some setup and showing the current sessions.
It is the codeunit that has a license to kill.
Ok. Thanks...
The dashboard should always be kept open to kill the Idle Session. Is it ???
I have seen in the debbuging mode that The Code under the OnTimer trigger of the Form (I have mentioned already) always Jump to the Codunit . How it is possible ??
You don't need to have the form open to kill sessions.
The NAS using the codeunit kills the sessions.
Each customer license has 1 NAS for free.
You have said in another post that "Function with ID 99 in codeunit 1 is only lauched once at the start of the NAS. It launches the code in that function and then finishes, never to enter again in that function."
I have written a small code for killing a Session in NAV 2009 SP1 but i dont know that it's properly working or not.. As i'm new to NAV PLS help me...OR give me a sample code....
CODE:
MaxUserIdleTime is the maximum idle time for a user after which his session should be deleted.
tempIdleTime is a variable where maximum user idle time will be getting updated.
MaxUserIdleTime := 10000;
tempIdleTime := 0;
recSession.SETRANGE(recSession."Database Name",'Demo Database NAV (6-0)_Old');
License := recSession.COUNT;
IF License > 2 THEN
BEGIN
IF recSession.FINDFIRST = TRUE THEN
BEGIN
REPEAT
BEGIN
IF recSession."Idle Time" >= MaxUserIdleTime THEN
BEGIN
IF recSession."Idle Time" >= tempIdleTime THEN
BEGIN
tempIdleTime := recSession."Idle Time";
SesId := recSession."Connection ID";
END;
END;
END;
UNTIL recSession.NEXT = 0;
END;
END;
MESSAGE('%1',tempIdleTime);
MESSAGE('%1',SesId);
//recSession.SETRANGE(recSession."Connection ID",SesId);
IF License > 2 THEN
BEGIN
IF recSession.FINDFIRST = TRUE THEN
REPEAT
BEGIN
IF recSession."Idle Time" >= tempIdleTime THEN
BEGIN
recSession.DELETE(TRUE);
MESSAGE('deleted');
COMMIT;
EXIT;
END;
END;
UNTIL recSession.NEXT = 0;
END;
I'm trying to import this objects, I'm using Microsoft Dynamics NAV 2009 SP1, and my error is the following:
"Automation is not an option. The existing options are: System, File, TransactionType", this occurs when Dynamics is importing this line (Object Codeunit 80000 Session Killer):
Comments
I've installed de NAS and the code, forms and tables. But it remains unusable:
The definition of the field User ID was changed after the object was saved
Old type: Text
New type: Code
Any idea?
Best regards(I've searched over and no answer at all)
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
But no luck...Usding Native NAV(NOT SQL) i think the method FINDFIRST is not possible.
I'm using nav 4.0 sp1.
Any idea ?
First I had the same error as you. Then I recompiled and I got no more errors.
2 things come in mind to test:
1) maybe the codeunit was in memory and after compiling it remained there. If you re-open the client it should take the new version of the codeunit and the problem should be solved.
2) If you have a problem with FINDFIRST, it means you have a client before 4.0SP1. FINDFIRST was introduced with 4.00SP1.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
We are planning to change the NAV partner, ours is %&%&**
I'm learning to control, program and debug my system.
I have a SUPER rol but i can't run some codeunits design some forms...
Any idea? its the license? I cant design even having all access to tables, forms codeunits and so on?
So i can work on a local copy of the db.
I hace setup up all the fobs on the dev nav and exported and imported on the porduction db.
Tha NAS starts but the user need some perms that i cannot find.
I have created arole sessionkiller with acces to te session table and all the objects in the fobs(tables, forms, and codeunit)
But i still missing something
If it works, than probably you still need to put the call to this codeunit in codeunit 1.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
If this does not apply to native databases..do we have any other solution.
Thanks in advance
Vijay
For test: Open Database -> File -> Database -> Information -> Sessions -> active Sessions -> DrillDown -> SessionList -> F4 to kill a session
Will this code work with Native DB as well?
Thanks
Vijay
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
This is a common error. It's caused because the type of the "User ID" on the virtual table is different between Native and SQL. You have to SAVE the object (normally a form) again, not just recompile from the object designer.
Second minor point, for the F4 kill to work on SQL the user must be a member of the SQL system administrator role with delete permission on the Navision session table. Just being a member of the Navision SUPER group is not enough.
TVision Technology Ltd
IF PtmpSession.SETCURRENTKEY("Idle Time") THEN BEGIN
// I am on SQL. SQL has a key on "Idle Time".
PtmpSession.ASCENDING(FALSE);
IF PtmpSession.FINDSET THEN <---- ERROR here
I'm using Nav 4.03 with SQL Server 2005. I'm able to sort on idle time in session form so i think the key is present. So ?
Tco
So, change from findset to find('-').
regards
IF ItmpSessionKillerMaxUserSess.GET(PtmpSession."User ID") THEN
IF NOT ItmpSessionKillerMaxUserSess."Never Kill Session" THEN
EXIT(TRUE);
Modified like this and it works for me :
//IF ItmpSessionKillerMaxUserSess.GET(PtmpSession."User ID") THEN
tmpICodeUserID := GetUserID(PtmpSession);
IF ItmpSessionKillerMaxUserSess.GET(tmpICodeUserID) THEN
IF NOT ItmpSessionKillerMaxUserSess."Never Kill Session" THEN
EXIT(TRUE);
Regards,
Tco
My problem is that no sessions are shown in the sessions table and no sessions are killed. Do I need to define the database or company somewhere in the CU?
I'm using NAV 6 with SQL Server and just run the CU out of the client for testing.
Phil
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
When I run the manually the code unit It run every x seconds as I ask him to do... but still no killing...
Is there any specific privilege (DB right or roles) I should set on every sessions or only on the account that run the NAS?
2010-08-20 12:51
EDIT: The problem occured only on windows session. Session with SQL logins are killed
programmeur-analyste
Cabico Custom Cabinetry
Instead of using a NAS, open a client and run the codeunit using the debugger to see what is happening.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
programmeur-analyste
Cabico Custom Cabinetry
The form should be always open to kill the Idle session. Is it ???
Can someone explain How does CurrForm.update(false) work here ???
It is the codeunit that has a license to kill.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Ok. Thanks...
The dashboard should always be kept open to kill the Idle Session. Is it ???
I have seen in the debbuging mode that The Code under the OnTimer trigger of the Form (I have mentioned already) always Jump to the Codunit . How it is possible ??
The NAS using the codeunit kills the sessions.
Each customer license has 1 NAS for free.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
You have said in another post that "Function with ID 99 in codeunit 1 is only lauched once at the start of the NAS. It launches the code in that function and then finishes, never to enter again in that function."
How will NAS kill the Idle Session ??
Will NAS call the Session Killer Codeunit again again automatically . ??
CODE:
MaxUserIdleTime is the maximum idle time for a user after which his session should be deleted.
tempIdleTime is a variable where maximum user idle time will be getting updated.
MaxUserIdleTime := 10000;
tempIdleTime := 0;
recSession.SETRANGE(recSession."Database Name",'Demo Database NAV (6-0)_Old');
License := recSession.COUNT;
IF License > 2 THEN
BEGIN
IF recSession.FINDFIRST = TRUE THEN
BEGIN
REPEAT
BEGIN
IF recSession."Idle Time" >= MaxUserIdleTime THEN
BEGIN
IF recSession."Idle Time" >= tempIdleTime THEN
BEGIN
tempIdleTime := recSession."Idle Time";
SesId := recSession."Connection ID";
END;
END;
END;
UNTIL recSession.NEXT = 0;
END;
END;
MESSAGE('%1',tempIdleTime);
MESSAGE('%1',SesId);
//recSession.SETRANGE(recSession."Connection ID",SesId);
IF License > 2 THEN
BEGIN
IF recSession.FINDFIRST = TRUE THEN
REPEAT
BEGIN
IF recSession."Idle Time" >= tempIdleTime THEN
BEGIN
recSession.DELETE(TRUE);
MESSAGE('deleted');
COMMIT;
EXIT;
END;
END;
UNTIL recSession.NEXT = 0;
END;
"Automation is not an option. The existing options are: System, File, TransactionType", this occurs when Dynamics is importing this line (Object Codeunit 80000 Session Killer):
autNavisionTimer@1101322000 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS;
Thanks.