CurrentUser object in Serverside Code

1 minute read time.
The CurrentUser object can be used in all serverside code including Create Scripts, Validation scripts, Table Level scripts and Workflow javascript conditions.

It provides information about the current user session.

You can list the properties of the CurrentUser object by using this snippet of code in any Create Script.

Valid = false;
ErrorStr ='';
var recCaption
var x
for (x in CurrentUser)
{
recCaption = eWare.FindRecord("custom_captions","capt_code = '"+x+"'");
ErrorStr += x +' ('+recCaption.capt_us+'): '+CurrentUser[x]+'
';
}

We can see the result:

user_displayname (User Template): Susan Maye
user_pwdprofile (Administration): 1
user_userid (User): 4
user_primarychannelid (Primary Team): 1
user_logon (User Name): MayeS
user_lastname (Last Name): Maye
user_firstname (First Name): Susan
user_language (Language): US
user_department (Department): US Sales
user_phone (Phone): 212 954 1902
user_fax (Fax): 212 954 1900
user_emailaddress (E-mail): [email protected]
user_per_admin (Administration): 1
user_resource (Resource): False
user_externallogonallowed (External Logon Allowed): True
user_primaryterritory (Home Territory): -2147483639
user_isterritorymanager (Territory Manager):
user_territoryprofile (Profile Name): 3
user_per_user (Info Admin User Rights): False
user_per_product (Info Admin Product Rights): True
user_per_currency (Info Admin Currency Rights): True
user_per_data (Info Admin Data Rights): False
user_offlineaccessallowed (PDA/WAP Access): True
user_rollupto (Forecasting - Reports To): 8
user_per_customise (Info Admin Customize): False
user_minmemory (Min memory for SQL to use on client (MB)):
user_maxmemory (Max memory for SQL to use on client (MB)):
user_title (Title): US and Canada Sales Manager
user_location (Location): NewYork
user_deskid (Desk Location): 5/2122
user_per_infoadmin (Info Admin Rights):
user_device_machinename (Device Name):
user_per_solutions (Solutions): 0
user_offlinesecurity (Allow Offline Access):
user_istemplate (Template): N
user_templatename (Template Name):
user_webserviceenabled (Allow Web Service Access): False
user_masterpersid (Hosting Master ID):
user_lastserver (undefined):
user_enabledonotreprice (Enable Overwrite price):
user_prf (undefined): mm/dd/yyyy