---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Preferences - Scoped, Global

# Preferences - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

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](https://servicenow-prod.fluidtopics.net/nzOhML1Q0x6_R94eZRa2ig#PreferenceDestinationBothAPI "The PreferenceDestination API updates user notification preferences.") API to update user notification
preferences.

This class uses the
`sn_notification`
namespace identifier.

## Preferences - Preferences(GlideRecord recipient) {#ariaid-title2}

Instantiates a Preferences object for a specified user.
{#Preferences-Preferences_O__table_bkn_fx3_wnb__entry__3}

| Name | Type | Description |
|-|-|-|
| recipient | GlideRecord | GlideRecord from the User \[sys_user\] table for the user that you want to get notification destinations for. |
[Table 1. Parameters]

{#Preferences-Preferences_O__table_bkn_fx3_wnb}  
This example instantiates a Preferences object for the user Abel Tuter.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);

## Preferences - getDestinations() {#ariaid-title3}

Returns a user's notification destinations.
{#Preferences-getDestinations__table_ept_hx3_wnb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 2. Parameters]

{#Preferences-getDestinations__table_ept_hx3_wnb} {#Preferences-getDestinations__table_fpt_hx3_wnb__entry__2}

| Type | Description |
|-|-|
| Array | Array of [PreferenceDestination](https://servicenow-prod.fluidtopics.net/nzOhML1Q0x6_R94eZRa2ig#PreferenceDestinationBothAPI "The PreferenceDestination API updates user notification preferences.") objects. If the user doesn't have any destinations, the array is empty. |
[Table 3. Returns]

{#Preferences-getDestinations__table_fpt_hx3_wnb}  
This example gets all of Abel Tuter's notification destinations. The output shows that Abel
has one destination.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);
    var dests = prefs.getDestinations();
    gs.print(dests);

Output:

    [object PreferenceDestination]

## Preferences - getDestinationsByChannel(GlideRecord channel) {#ariaid-title4}

Returns a user's notification destinations that use a specified channel.
{#Preferences-getDestinationsByChannel_O__table_x4m_lx3_wnb__entry__3}

| Name | Type | Description |
|-|-|-|
| channel | GlideRecord | GlideRecord from the Notification Channel \[sys_notification_channel\] table for the channel you want to filter on. |
[Table 4. Parameters]

{#Preferences-getDestinationsByChannel_O__table_x4m_lx3_wnb} {#Preferences-getDestinationsByChannel_O__table_y4m_lx3_wnb__entry__2}

| Type | Description |
|-|-|
| Array | Array of [PreferenceDestination](https://servicenow-prod.fluidtopics.net/nzOhML1Q0x6_R94eZRa2ig#PreferenceDestinationBothAPI "The PreferenceDestination API updates user notification preferences.") 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. |
[Table 5. Returns]

{#Preferences-getDestinationsByChannel_O__table_y4m_lx3_wnb}  
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.

    var recipient = new GlideRecord('sys_user'); 
    recipient.get('last_name', 'Tuter'); 
    var prefs = new sn_notification.Preferences(recipient);
    var channel = new GlideRecord('sys_notification_channel');
    channel.get('name', 'Workspace'); 
    var dests = prefs.getDestinationsByChannel(channel);
    gs.print(dests);

Output:

    [object PreferenceDestination]


