Custom Notification in Salesforce Apex, Apex Trigger
trigger CaseTrigger on Case (after insert) { CustomNotificationType notificationType = [SELECT Id, DeveloperName FROM CustomNotificationType WHERE DeveloperName='Notification']; List<Messaging.CustomNotification> notifications = new List<Messaging.CustomNotification>(); for (Case c : Trigger.new) { Messaging.CustomNotification notification = new Messaging.CustomNotification(); notification.setTitle('New Case Created: ' + c.CaseNumber); notification.setBody('A new case has been created with the subject: ' + c.Subject); notification.setTargetId(c.Id); ...