Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Developer
easy

What is the Custom Notification API and how do you use it from Apex?

Custom Notifications let you send in-app and mobile push notifications to specific users, configurable via Setup and triggerable from Apex/Flow.

Setup: Setup -> Custom Notification Types -> New. Define a notification type (name, supported channels: Desktop, Mobile).

From Apex:

apex CustomNotificationType ct = [SELECT Id FROM CustomNotificationType WHERE DeveloperName = 'Account_Updated']; Messaging.CustomNotification notification = new Messaging.CustomNotification(); notification.setTitle('Account Updated'); notification.setBody('Acme Corp has been updated'); notification.setNotificationTypeId(ct.Id); notification.setTargetId(accountId); notification.send(new Set<String>{userId});

Notifications appear in the bell icon (in-app) and as push notifications on mobile (if the user has the Salesforce mobile app installed and notifications enabled).

Use cases: alert account owner when their account changes, notify approvers of pending requests, mention users on critical updates.

Limitations: no rich content (just title + body), per-org rate limits, mobile delivery depends on user's app config and OS permissions.

Why this answer works

Foundational. Most devs don't know this exists; mentioning it signals breadth.

Follow-ups to expect

Related dictionary terms