Table of Contents

Customizing notification preferences by using APIs

You can use APIs to set, retrieve, and remove notification preferences for a user. Use the following APIs to build custom user interfaces that can set preferences in your application.

Set preferences

Use the following APIs to add or update preferences for a user.

pxSetNotificationPreference

API

pxSetNotificationPreference

Description

Use this API to add or update user preferences for notification definitions for a user in a specific case class.

Type

Activity

Class

@baseclass

Parameters

Required:

NotificationName: Notification definition for which the preference needs to be set.

Channel: Notification channel over which the notification needs to be sent, for example, email or web gadget.

Optional:

UserIdentifier: User for whom the preferences need to be set. Unless specified, the current user preferences are updated by default.

ContextClass: Case class in which the activity is run.

ContextKey: Instance key (pzInsKey).

Frequency: Specifies how often email notifications are sent: Instant, Daily, Weekly, or Disable. The default value is Disable.

Notes

When the preferences changes are successful, the new preferences are saved to the database.

Retrieve preferences

Use the following APIs to retrieve the current preferences of a specific user.

D_pxNotificationDefinitions

API

D_pxNotificationDefinitions

Description

Use this API to retrieve the list of available notification definitions within a specific application for the current user.

Type

Data page

Parameters

Required:

ApplicationName: Application for which the list of notification definitions needs to be retrieved.

Success response

Results are listed under the property pxResults. Notification definitions in the @baseclass are grouped under Generic notifications. Case class notification definitions are listed under each case class.

pxIsNotificationPreferencesSet

API

pxIsNotificationPreferencesSet

Description

Use this API to filter out users based on whether preferences are set from a specific list of users.

Type

Activity

Class

@baseclass

Parameters

Required:

NotificationName: Notification definition for which the preference needs to be set.

Channel: Notification channel over which the notification needs to be sent, for example, email or web gadget.

ContextClass: Case class in which the activity is executed.

Optional:

UserIdentifierList: Comma-separated list of users from which users need to be filtered.

Application: Application in which the notification definitions are available.

Frequency: Specifies how often email notifications are sent: Instant, Daily, or Weekly. The default value is Instant.

ContextKey: Instance key (pzInsKey).

Success response

A comma-separated list that contains the filtered users.

pxIsNotificationsDisabled

API

pxIsNotificationsDisabled

Description

Use this API to determine whether notifications are disabled for a specific user.

Type

When

Class

@baseclass

Parameters

None

Success response

Returns the Boolean value true if notifications are disabled.

Remove preferences

Use the following APIs to remove the current user preferences.

pxRemoveNotificationPreference

API

pxRemoveNotificationPreference

Description

Use this API to remove notification preferences for a specific user.

Type

Activity

Class

@baseclass

Parameters

Required:

NotificationName: Notification definition for which the preference needs to be set

Channel: Notification channel over which the notification needs to be sent, for example, email or web gadget.

Optional:

UserIdentifier: Operator ID of the user for which the preferences need to be removed. Unless specified, the current operator ID is used by default.

ContextClass: Case class in which the activity is run.

ContextKey: Instance key (pzInsKey).

ApplicationName: Application in which the notification definitions are available.

Notes

Removing preferences for a user permanently deletes the notification preference record from the database.

Disable notifications

Use the following API to turn off all notifications for a user.

pxDisableNotifications

API

pxDisableNotifications

Description

Use this API to disable or enable notifications for a user.

Type

Activity

Class

@baseclass

Parameters

Disable: Set to true to disable notifications. When left blank, notifications are enabled.

Panel Body

100% found this useful


Related Content

Have a question? Get answers now.

Visit the Pega Support Community to ask questions, engage in discussions, and help others.