Monitoring Events in Sessions
- Last UpdatedNov 06, 2025
- 2 minute read
When a new user logs onto a session, or the current user is changed, the aaFactMES.aaClientSession object can inform you about this. To do this you need to set a UDA to UserChanged_DateTime variable in the aaFactMES.aaClientSession object. You must then create a Data Change script triggered by this UDA.
Example: Monitor Events Script
You can call the MonitorEvents script to check for new events that have occurred on the aaFactMEScontrol.
You can use the MonitorEvents script as an Execute / Periodic script with a trigger period of 00:00:01.0000000.
' MonitorEvents 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) then
' Get the DateTime of each event we are interested in
' and store it in a UDA. The DateTime will
' change each time the event fires. Use the UDA as a trigger
' on another event handler script (see UserChanged script)
' NOTE: the UserChanged UDA should be a string
me.UserChanged = clientSession.UserChanged_DateTime;
endif;
Example: UserChanged Script
You can call the UserChanged script when the trigger UDA changes. The trigger indicates that an event has arrived and should be processed.
Every event in the Client API will have a date time property exposed in the Client API Wrapper. Every time an event is fired the date time property associated with that event will be updated with the date time the event was fired. The user will then have to poll this property and keep track of its value so they can determine when an event occurred. The polling script will change the trigger UDA when it finds that a change has occurred.
Every event in the Client API will have a date time property exposed in the Client API Wrapper. Every time an event is fired the date time property associated with that event will be updated with the date time the event was fired. The user will then have to poll this property and keep track of its value so they can determine when an event occurred.
You can use the UserChanged script as an Execute or Data Change script with a trigger UDA (me.UserChanged) that is set in the Monitor Events script.
' UserChanged Script
dim clientSession As aaFactMES.aaClientSession;
dim result As aaFactMES.Result;
dim userName as string;
' Get the singleton client session
result = aaFactMES.aaClientSession.GetInstance();
clientSession = result.Value;
userName = "???";
if (clientSession <> null) then
if (clientSession.UserChanged_e <> null) then
if (clientSession.UserChanged_e.UserObject <> null) then
userName = clientSession.UserChanged_e.UserObject.UserName;
endif;
endif;
LogMessage("User changed to " + userName );
endif;