unkonwn type aaFactMES.aaClient Session

HI Everyone

I am currently upgrading from MES 2017 to 2023 and there is a script which is working perfectly on 2017 and its giving issues on the new version 2023. 

When I run the script, it says: unkonwn type: aaFactMES.aaClient Session.

The script is supposed to open a session and log users in automatically, but it appears to be failing in the new version, as an error is occurring.

This is the script below:

IF IsGood(EntityName) THEN

LogMessage ("EntityName is Good = " + EntityName);

Dim clientSession as aaFactMES.aaClientSession;
Dim result as aaFactMES.Result;
Dim resultEnt as aaFactMES.Result;
Dim entityID as Integer;

result = aaFactMES.aaClientSession.GetInstance();
clientSession = result.Value;

clientSession.Login("admin", "admin");
LogMessage ("Clientsession =WONDER " + clientSession);
'If (clientsession <> null) Then
If clientSession.SessionId > 0 Then
IntDwntSessionID = clientSession.SessionId;
LogMessage("EXISTING SESSION");
LogMessage("UserID: admin");
LogMessage("UserPW: admin");

IntDwntSessionID = clientsession ;
LogMessage("IntDwntSessionID: " + IntDwntSessionID);
LogMessage("clientsession : " + clientsession );

LogMessage("Logged in to session OK before IF");
LogMessage("Me.Tagname : " + EntityName);

If ( clientSession.curUser <> null and EntityName <> "" ) then
LogMessage("Logged in to session OK Inside IF");
' get Entity ID from input UDA Entity Name
resultEnt = aaFactMES.aaEnt.EntIdFromName( EntityName );
logmessage("resultEnt" + resultEnt);
If ( resultEnt.Success == true and resultEnt.Int32_Value <> -1) then
' go an entity ID - attempt to logon
entityID = resultEnt.Int32_Value;
resultEnt = clientSession.curUser.LogonEnt( entityID, "", 100.0 );
If ( resultEnt.Success == true ) then
' Print Success message
LogMessage(clientSession.curUser.userName + " has logged onto entity " + EntityName + " - id=" + StringFromIntg(entityID, 10) );
Endif;
Else
' Failed to get Entity ID from Entity Name
LogMessage("Entity " + EntityName + " does not seem to exist");
Endif;
Endif;

Else
LogMessage("START SESSION");

result = aaFactMES.aaClientSession.GetInstance();
clientSession = result.Value;
IntDwntSessionID = clientSession.SessionId;

LogMessage("IntDwntSessionID: " + IntDwntSessionID);
LogMessage("clientsession : " + clientsession );

' login to session automatically

'If ( clientSession <> null and clientSession.SessionId == -1) then
' Start the session. Only do this if a session isn't already started
clientSession.Login("admin", "admin");
result = clientSession.StartSession (aaFactMES.aaClientTypes.clientOperator);
If (result.Success == true) then
LogMessage("Session Started!");
' Login a user - this should cause a UserChanged event (see MonitorEvents script)
result = clientSession.Login("admin", "admin");
If (result.Success == true) then
LogMessage("Login succeeded!");

'******************************************
LogMessage("Me.Tagname : " + EntityName);
If ( clientSession.curUser <> null and EntityName <> "" ) then
LogMessage("Logged in to session OK Inside IF");
' get Entity ID from input UDA Entity Name
resultEnt = aaFactMES.aaEnt.EntIdFromName( EntityName );
logmessage("resultEnt" + resultEnt);
If ( resultEnt.Success == true and resultEnt.Int32_Value <> -1) then
' go an entity ID - attempt to logon
entityID = resultEnt.Int32_Value;
resultEnt = clientSession.curUser.LogonEnt( entityID, "", 100.0 );
If ( resultEnt.Success == true ) then
' Print Success message
LogMessage(clientSession.curUser.userName + " has logged onto entity " + EntityName + " : id=" + StringFromIntg(entityID, 10) );
Endif;
Else
' Failed to get Entity ID from Entity Name
LogMessage("Entity " + EntityName + " does not seem to exist");
Endif;
Endif;

'*****************************************

Endif;
Else
LogMessage("Session failed to start!");
Endif;
'Endif;

Endif;

Logmessage("INITIALIZE = True");
Initialised= True;
Endif;

Parents Reply Children