--- title: PreferenceDestination - Scoped, Global description: The PreferenceDestination API updates user notification preferences.Returns the channel that is used to send notifications to the destination.Returns the identifier for the destination.Returns the type of destination, such as personal email or work email.Checks if the destination has permission to receive a notification.Checks if a notification overrides a user's preferences for the destination.Sets the user preference for a destination to receive or not receive notifications. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/api-reference/server-api-reference/PreferenceDestinationBothAPI.html release: australia product: Server API Reference classification: server-api-reference topic_type: concept last_updated: "2026-03-12" reading_time_minutes: 5 breadcrumb: [Server API reference, API reference, API implementation and reference] --- # PreferenceDestination - Scoped, Global The PreferenceDestination API updates user notification preferences. 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. A user can update their own notification preferences, and an admin can update notification preferences for any user. User notification preferences control which destinations will receive which notifications. Use this API with the [Preferences](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/PreferencesBothAPI.md) API. Before calling any methods in this class, you must call the Preferences.getDestinations\(\) or Preferences.getDestinationsByChannel\(\) methods to instantiate a PreferenceDestination object. This class uses the `sn_notification` namespace identifier. **Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md) ## PreferenceDestination - getChannel\(\) Returns the channel that is used to send notifications to the destination. |Name|Type|Description| |----|----|-----------| |None| | | |Type|Description| |----|-----------| |GlideRecord|GlideRecord from the Notification Channel \[sys\_notification\_channel\] table for the channel that is used to send notifications to the destination.| This example prints the channel that is used to send notifications for each of Abel Tuter's destinations. ``` var recipient = new GlideRecord('sys_user'); recipient.get('last_name', 'Tuter'); var prefs = new sn_notification.Preferences(recipient); var dests = prefs.getDestinations(); for (var i=0; i Type Description Boolean Flag that indicates whether the destination has permission to receive a notification.Possible values: - true: The destination has permission receive a notification. - false: The destination doesn't have permission to receive a notification. This example checks if each of Abel Tuter's destinations has permission to receive the Approval Request notification. ``` var recipient = new GlideRecord('sys_user'); recipient.get('last_name', 'Tuter'); var prefs = new sn_notification.Preferences(recipient); var dests = prefs.getDestinations(); var notif = new GlideRecord('sys_notification'); notif.get('name', 'Approval Request'); for (var i=0; i Type Description Boolean Flag that indicates whether the notification overrides user preferences for the destination. Valid values: - true: User preferences for the destination are ignored for this notification. - false: The destination receives or doesn't receive the notification according to the user preference. This example checks if the Approval Request notification overrides user preferences for one of Abel Tuter's destinations. If the notification doesn't override user preferences, the destination is given permission to receive the notification. Otherwise, no preference is set because the notification overrides the preference. ``` var recipient = new GlideRecord('sys_user'); recipient.get('last_name', 'Tuter'); var prefs = new sn_notification.Preferences(recipient); var dests = prefs.getDestinations(); var notif = new GlideRecord('sys_notification'); notif.get('name', 'Approval Request'); var firstDest = dests[0]; if (!firstDest.isOverridden(notif)) { dests[0].setActive(notif, true); } else { gs.print('This notification overrides user preference, so don't bother to set a preference.'); } ``` ## PreferenceDestination - setActive\(GlideRecord notification, Boolean active\) Sets the user preference for a destination to receive or not receive notifications. The isOverriden\(\) method can be called first to check if the user preference will be ignored, but it is not required.
Name Type Description
notification GlideRecord Optional. If a notification is specified, the user preference is set for the destination to receive or not receive that notification. The notification should be a GlideRecord from the Notification \[sys\_notification\] table. If no notification is specified, the user preference is set for the destination to receive or not receive all notifications.
active Boolean Flag that indicates whether the destination has permission to receive a notification. Valid values: - true: The destination has permission receive a notification. - false: The destination doesn't have permission to receive a notification.
|Type|Description| |----|-----------| |None| | This example checks if the Approval Request notification overrides user preferences for one of Abel Tuter's destinations. If the notification doesn't override user preferences, the destination is given permission to receive the notification. Otherwise, no preference is set because the notification overrides the preference. ``` var recipient = new GlideRecord('sys_user'); recipient.get('last_name', 'Tuter'); var prefs = new sn_notification.Preferences(recipient); var dests = prefs.getDestinations(); var notif = new GlideRecord('sys_notification'); notif.get('name', 'Approval Request'); var firstDest = dests[0]; if (!firstDest.isOverridden(notif)) { dests[0].setActive(notif, true); } else { gs.print('This notification overrides user preference, so don't bother to set a preference.'); } ```