IGrooveFormsToolApplicationPreferences Interface

The IGrooveFormsToolApplicationPreferences interface provides a mechanism for defining and accessing preferences. Preferences are persisted name-value pairs that are defined locally for the Groove Identity in the Forms tool.

Methods

DeletePreference

Deletes an application preference with the specified name.

DoesPreferenceExist

Tests if an application preference is stored with the specified name.

GetPreference

Gets the value of the application preference stored with the specified name.

SetPreference

Defines and sets the value of the application preference with the specified name.

Remarks

Application preferences allow you to store preferences for a user in the Forms tool. These preferences are retained from one Groove session to the next. For example, form scripts can use application preferences to use the last values specified in a new record as the defaults for the same fields in the next new record. An application preference is stored as a variant value associated with a name.

The SetPreference method defines a name and assigns a value to it. If a name is already defined, SetPreference assigns a new value to it. GetPreference retrieves the current value assigned to the name. If a name has not been defined, or if it has been deleted, GetPreference then produces a script error. Consequently, you should use the DoesPreferenceExist method to check if a name is defined, before you get its value.

An application preference remains in effect, until it is deleted with the DeletePreference method.

Example

To get access to the IGrooveFormsToolApplicationPreferences object, you must first get the interface from the IGrooveFormsToolUIDelegate Interface object that is available from the GetApp() function. See Public Script Functions for more information on GetApp().

var ApplicationPreferences = GetApp().IGrooveFormsToolApplicationPreferences;
if (!ApplicationPreferences.DoesPreferenceExist("NewPreference"))
{
  // if data is not defined, initialize it
  ApplicationPreferences.SetPreference("NewPreference", 123);
}
// ...
// If data is obsolete, delete it
ApplicationPreferences.DeletePreference("NewPreference");

See Also

Reference

IGrooveFormsToolSessionData Interface