Preferences - Scoped, Global
-
- UpdatedJan 30, 2025
- 2 minutes to read
- Yokohama
- API reference
The Preferences API gets notification destinations for a user.
A notification destination is somewhere that a notification can be delivered to, such as a specific email address or phone number. This API is based on notifications from the Notification [sys_notification] table. Notifications are sent through channels such as email or Workspace. A channel can be used to send notifications to multiple types of destinations. For example, an email channel could send notifications to both personal email and work email destinations. Destination types are listed in the Notification Destination Type [sys_notif_destination_type] table.
Use this API with the PreferenceDestination API to update user notification preferences.
This class uses the
sn_notification
namespace identifier.
Preferences - Preferences(GlideRecord recipient)
Instantiates a Preferences object for a specified user.
Name | Type | Description |
---|---|---|
recipient | GlideRecord | GlideRecord from the User [sys_user] table for the user that you want to get notification destinations for. |
Example
This example instantiates a Preferences object for the user Abel Tuter.
Preferences - getDestinations()
Returns a user's notification destinations.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
Array | Array of PreferenceDestination objects. If the user doesn't have any destinations, the array is empty. |
Example
This example gets all of Abel Tuter's notification destinations. The output shows that Abel has one destination.
Output:
Preferences - getDestinationsByChannel(GlideRecord channel)
Returns a user's notification destinations that use a specified channel.
Name | Type | Description |
---|---|---|
channel | GlideRecord | GlideRecord from the Notification Channel [sys_notification_channel] table for the channel you want to filter on. |
Type | Description |
---|---|
Array | Array of PreferenceDestination objects. If the user doesn't have any notification destinations that use the channel or if the channel doesn't exist, the array is empty. |
Example
This example gets all of Abel Tuter's destinations that use the Workspace channel. The output shows that Abel has one destination that uses the Workspace channel.
Output: