Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

MES Stateful API

Ending Sessions

When the application is terminating, you can use the code in the Term script shown below to end the session. If you do not end a session, the MES service cleans it up as soon as it determines that the session is stale.

You can call the Term script to clean up and end a session. The Term script should be called one time by one Application Object.

You can use the Term script as either an OffScan or Execute script with some attribute-based trigger. If you use it as an Execute script, you should mark it as an asynchronous script.

' Term Script
 dim clientSession As aaFactMES.aaClientSession;
dim result As aaFactMES.Result;
 ' Get the singleton client session
 result = aaFactMES.aaClientSession.GetInstance();
 clientSession = result.Value;
 if ( clientSession <> null and clientSession.SessionId <> -1 ) then
      ' log everyone off and stop session
      clientSession.LogOffAllUsers();
      clientSession.EndSession();
      LogMessage("Session Ended");
endif;

TitleResults for “How to create a CRG?”Also Available in