Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

System and User Settings

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);

NoteThe getSystemSetting() and getUserSetting() methods always return String values.

  • 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 SettingsServiceSettingsService 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");

Adding Custom Settings

You can add user and system custom settings to TeamConnect using the API. When you add a custom setting, you can enter custom code so that the setting works throughout TeamConnect.

To add custom settings, use the setSystemSetting() and setUserSetting() methods that receive the custom setting name parameter. Even though custom setting values save as String values, you can convert the setting to another data type as part of the code.

For example, if you want to create a new user setting with the New Custom Setting key, use the following code:

// Adds a new custom setting to the system.
// Making the same call after the setting is initially added updates the value like it does for non-custom settings.
platform.getSettingsService().setSystemSetting("New Custom Setting", "10");
// Setting values save as a String, so you can convert the String to an Integer or another data type.
// You can enter custom code to check the value of the newly added setting and impact parts of TeamConnect.
if(Integer.valueOf(platform.getSettingsService().getSystemSetting("newCustomSett ing")) > 5) {
    // Custom code here 
} 

NoteIf New Custom Setting already exists when you enter the previous code, the setting updates with the new value.

  • Was this article helpful?