Custom Notifications in Salesforce
Custom Notifications alert users about important events in Salesforce.
Configured by selecting supported channels (desktop/mobile).
Send using Flow, Apex.
Use Cases:
Lead Assignment Notification
Case Escalation Alert
Approval Request Notification
Task Reminder
Opportunity Stage Change
Record ownership Change
Creating Notification Types:
Go to quick find in setup and search custom notifications
Create notification types in Setup and choose desktop/mobile channels.
Send custom notifications:
Sending Notifications with Flow
Record-Triggered Flows can send notifications when records are created or updated.
Using Apex
Developers can send notifications programmatically using Messaging.CustomNotification class.
private static void sendNotification(String name, Id targetId, Id ownerId) {
// if (ownerId != null) {
// Messaging.CustomNotification notification = new Messaging.CustomNotification();
// notification.setBody(name + ' is now waiting for Review.');
// notification.setTitle('Notification Alert');
// notification.setSenderId(Userinfo.getUserId());
// CustomNotificationType type = [SELECT Id FROM CustomNotificationType WHERE DeveloperName = 'IA_Status_Change_Notifications'];
// notification.setNotificationTypeId(type.id);
// notification.setTargetId(targetId);
// notification.send(new Set<String> { ownerId });
// }
// }
In Flow -
1. Get Custom Notification Type - Record
2. Set User Id in set variable.
3. Send using action.


0comments
Post a Comment