xSession.userId Method
Retrieves the user ID that this session is logged on with.
Syntax
public UserId userId()
Run On
Called
Return Value
Type: UserId Extended Data Type
The ID for the user of the session.
Examples
The following example determines whether a particular user is online.
server static boolean isUserOnline(userId userId)
{
xSession session;
int counter;
int maxSessions = Info::licensedUsersTotal();
if (!userId)
{
return false;
}
for(counter = 1; counter < maxSessions;counter++)
{
session = new xSession(counter, true);
if(session && session.userId() == userId)
{
return true;
}
}
return false;
}