Global Event: OnSetUserPreferences

The OnSetUserPreferences Event is used to store user preferences when setting startup reports or saving interactive html changes as user reports.


For custom code the args array is structured as follows:

args[] is contains two objects, the first a string with the user preference’s id and the second a string with the user preference’s value.  

For .Net Assemblies the method signature is as follows:

void EventHandlerName(SessionInfo sessionInfo, string id, string value)

Expected Return

The event has a void return value.


The event will only be called if the ‘User Preference Storage Method’ is set to Server Events in the User Settings.


The following example shows how the event can retrieve the user preference’s value from a database.

//this code retrieves user preferences from a database. This assumes two things:
// 1. A global variable exists called reportTableName which represents where the user preferencs are stored 
// 2. A method called ExecuteSQLCmd exists to execute sql statements
string stmt = String.Format("Select upValue From {0} Where id = @id",  reportTableName);
List<SqlParameter> sqlParams = new List<SqlParameter>();
sqlParams.Add(new SqlParameter("@id", id));
Object queryResult;
queryResult = ExecuteSQLCmd(stmt, sqlParams);
return queryResult == null ? null : queryResult.ToString();

Hidden Article Information

Article Author
Exago Development
created 2017-02-21 16:08:27 UTC
updated 2017-06-27 14:46:32 UTC

Server Events, event handlers, list of server events, User Preferences, Preferences, user, prefs, set, preferences, setuserpreferences, userprefs, setprefs,
Have more questions? Submit a request