Show/Hide Toolbars

You can use the API to retrieve and update system and user settings. System settings are settings an administrator updates from the Admin Settings. User settings are settings that a user updates on their Preferences page. When working with these settings in the API, you use SettingsService with the SettingKey enums.

SettingsService Interface

SettingsService provides methods to retrieve and update system and user settings. This interface includes the following types of methods:

Methods that retrieve the value for a setting—Most SettingsService methods retrieve a value for a specific setting. For example, the following method returns the filename of the custom logo image.

settingsService.getSystemCustomLogoImage();

For settings that do not have a specific get method, you can use the getSystemSetting() or getUserSetting() methods. You can also use these methods for settings that do have a get method. For example, the following code returns the filename of the custom logo image, just as the getSystemCustomLogoImage() method does.

settingsService.getSystemSetting(SettingsKey.CUSTOM_LOGO_IMAGE);

Note: The getSystemSetting() and getUserSetting() methods always return String values. Convert each value to another data type, such as an Integer or Boolean, if necessary. Get methods for specific settings, such as getSystemMaxUploadSize(), return the appropriate data type for the TeamConnect field.

Methods that set the value of a setting—You use the setSystemSetting() and the setUserSetting() methods to set the values for system and user settings. SettingsService does not provide methods for setting specific settings.

Note: Use the following code to access SettingsService: SettingsService settingsService = platform.getSettingsService();

Two Types of Setting Parameters

Two methods of the same name exist for each of the following previously mentioned methods: getSystemSetting(), getUserSetting(), setSystemSetting(), and setUserSetting(). These two methods are different because they each use two different types of parameters:

The enums in the SettingKey class. This class includes enums for all user and system settings.

The key of a custom setting. You can only add a custom setting through the TeamConnect API, not from the TeamConnect Setup.

For an example of the different types of parameters, the next two code samples use the two different setSystemSetting() methods.

In the following sample, setSystemSetting() uses a SettingKey enum as a parameter. Using the SEARCH_MAX_TIME setting key, this code updates the Maximum Search time (seconds) field in the Admin Settings to a value of 25.

settingsService.setSystemSetting(SettingsKey.SEARCH_MAX_TIME, "25");

The following sample includes a custom field as a parameter for setSystemSetting(). This code updates a custom field in the Admin Settings, specified by the Custom System Setting parameter, to a value of 25.

settingsService.setSystemSetting("Custom System Setting", "25");