KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility Method to Obtain User Session Info
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: May 6, 2024

The following method returns all or a specific user session info from 4D Server.

// Method: getUserSessions
// This method must be set to execute on Server

#DECLARE($userName_t : Text)->$userSess_c : Collection

$userSess_c:=Get process activity(Sessions only).sessions
If (Count parameters>0) // Looking for a specific user session
     $userSess_c:=$userSess_c.query("userName = :1"; $userName_t)
End if


Important: The command Get process activity returns a snapshot of connected user sessions. However, this command can only executed on the Server. Since the above method utilizes the command, the method must be set to execute on 4D Server.