How To Get the Current Logged in User


The object can be used to get the id for the currently logged in user.


If the security system has been enabled in an application, you can get the id for the currently logged in user using If the user is logged in, will contain the user's id. If the user is not logged in, will be blank.

Before using the value in, you must first verify that no error occurred when fetching the user id. If an error occurred, the value in cannot be used.

The object can be checked to verify the operation was successful. You should always check the value of before using the value from any property or method of the object.

The example below demonstrates how to get the user id:

dim userName as C = Context.Security.CurrentUser

if .not. Context.Security.CallResult.Success then 
end if 

if alltrim(userName) = "" then 
   'Display  "no user is logged in." 
   'Display user name 
end if

See Also