SwitchUser Method
- Last UpdatedNov 06, 2025
- 2 minute read
Parameters
- sessionId
Required. Holds the session ID and thus the active user who is being changed.
- userId
- Required. Holds the ID of the new active user of the session. This user must already have logged into the session and at least one entity.
- userPw
- Optional. Holds the user password for the new user, which will be compared to the encrypted password stored in the database. If the system parameter ‘Password Required for SwitchUser’ is set, then this parameter is required every time this method is invoked.
This method changes the active user in the Sessn table.
This method is typically used with Operator clients. However, if the password is included, it could be used for other client applications to change the current user_id on the session if the authentication is successful.
For Operator clients, if the userPw parameter is included, authentication will always be performed. This prevents switching users without password authentication for those sites that wish to operate this way. If the userPw parameter is not included, then this user must already have logged on to at least one entity at this time. Otherwise, the user should use the LogIn() method and then log on to some entities.
In the ‘unique passwords’ case, the client application should have saved the user_id value after the initial logon, and this user_id value should be included in all calls to this method.
This method has no effect on the labor capture module, if it is licensed, as all users are still logged in and labor hours are being captured against them.
This method replaces the current ent.SwitchUser() method.