Persistent notifications

If a notification toast contains very important information, It can be useful to make it stay visible on the desktop until the user interacts with it. Toasts that do this are called "persistent." However, you should use this capability sparingly, to avoid annoying the user with too many persistent toasts. Persistent toasts appear in a "stack" on the desktop, to avoid consuming too much screen area.

11671167

Image showing stack of persistent toasts as they appear on a desktop, with a badge showing the number of toasts and their urgency

User story

Suppose your management has given you the following user stories to implement:

  1. As the head of a trade desk, I want to ensure that traders who are interested in Wayne Enterprises see any relevant news, so that they can stay up to date on current performance and can take action in a timely manner.

  2. As a user of a financial desktop, I want to ensure that I do not miss notifications from important sources amid all the things vying for my attention, so that I can take action about them.

Recipe

To make a toast persistent, you can use the sticky value of the toast configuration option; the default value is transient.

📘

Note

In versions prior to Workspace 6.0, the name of this option was sticky (with values sticky and transient). In Workspace 6.0 and later, that name is supported but deprecated.

To ensure that users understand the reason for a toast being persistent, you must also use the indicator option to signal to the user about the nature of the event that the toast is about. See the recipe to show the urgency of a notification for more details.

Code example

const notification = {
   "title": "Stop Loss of 47.22 for Brent Oil Futures reached",
   "category": "Trade",
   "body": "Your stop limit for Brent Oil has been reached. Proceed with the purchase of 1000 Futures?",
   "icon": "http://cdn.openfin.co/examples/notifications/company-T.png",
   "toast": "sticky",
   "indicator": {
       "text": "Stop Limit Reached",
       "color": "yellow"
   },
   "buttons": [
       {
           "title": "Buy Now",
           "type": "button",
           "cta": true, //makes the button prominent by coloring it blue
           "onClick": {
               "task": "buy-threshhold-stock",
               "customData": {
                   "message": "Example data to send back when this entry is clicked"
               }
           }
       },
       {
           "title": "Cancel Order",
           "type": "button",
       }
   ]
};
 
 create(notification);

More info

Users can turn off notifications from your app. In future releases, users may be able to turn off persistence of toasts from your app. Therefore, it is not guaranteed that a toast you specify as sticky will always be displayed or be persistent.

For information on suppressing the toast for a notification, refer to Notifications without toasts.