NAV database locking table: log

txerifftxeriff Member Posts: 314
edited 2020-03-27 in NAV Three Tier
Hi All,

I hope some1 can help.

I was trying to log "database locking" system table, into another table, by using few events. However, I can´t make it populate any data.


This should make event below to happen.

T36.RESET;
//T36.LOCKTABLE(TRUE);
IF T36.GET(T36."Document Type"::Order,'myoder') THEN BEGIN
T36."Sell-to Address":=T36."Sell-to Address"+'*';
T36.MODIFY;
SLEEP(20000);
END;


This would log into a 50K table:


LOCAL [EventSubscriber] TDatabaseLocksOnAfterInsert(VAR Rec : Record "Database Locks";RunTrigger : Boolean)

IF NAVLockingLog.GET(Rec."Transaction ID") THEN ;
NAVLockingLog.DELETE;
NAVLockingLog.INIT;
NAVLockingLog."Transaction ID":=Rec."Transaction ID";
NAVLockingLog."Object Name":=Rec."Object Name";
NAVLockingLog."Resource Type":=Rec."Resource Type";
NAVLockingLog."Request Mode":=FORMAT(Rec."Request Mode");
NAVLockingLog."Request Status":=FORMAT(Rec."Request Status");
NAVLockingLog."User Name":=Rec."User Name";
NAVLockingLog."AL Object Type":=FORMAT(Rec."AL Object Type");
NAVLockingLog."Al Object ID":=Rec."AL Object Id";
NAVLockingLog."AL Methsod Scope":=Rec."AL Method Scope";
NAVLockingLog."Lock start date":=WORKDATE;
NAVLockingLog."Lock start time":=TIME;
NAVLockingLog.INSERT;



I know you can SQL query this, but I wanted to log into NAV. Let´s say any locks over 1 minute, log them.


thx.
Sign In or Register to comment.