My customer wants to send bell notifications whenever you add an Attendant to an Event.

Is there a way to create custom bell notifications via apex code?

If not, is it possible to achieve this without any mail provider integration?

enter image description here

  • 1
    I am not sure if it is the best option, but I had a very similar requirement. I archived thru an apex that create a FeedItem. – m Peixoto Apr 8 at 13:57
  • @mPeixoto How did you achieve that? Cause I'm not finding anything usefull for my particular case – molinet Apr 8 at 14:11
  • You could create a FeedItem and the Parent ID will be the user that will receive the Bell Notification. In this case, a chatter will be created mentioned the user and a notification will be created – m Peixoto Apr 8 at 14:37
  • Another approach, if you want to use a Chatter Post. Could you trigger a Process Builder when a new attendant is created? So, you could use Process Builder to create a chatter post. – m Peixoto Apr 8 at 14:38

I am not sure if it is the best approach, but I had a situation very close of that. I needed to create a notification for an user linked with a Case.

    List<FeedItem> FeedItemList = New List<FeedItem>();

    for (Case caseitem : CaseCreateAlert) {

        FeedItem post = new FeedItem();

        post.ParentId = caseitem.OwnerId;
        post.Body = caseitem.Message_To_Alert__c;
        post.Title = 'Case';
        post.LinkUrl = '/lightning/r/Case/' + caseitem.ID + '/view';


    if (FeedItemList.size()>0) {         
            insert FeedItemList;                

This source code is not perfect and it is for reference only. You could have issue if the case owner is a Queue, for example.

  • Thanks! I'll try that! – molinet Apr 8 at 14:47
  • Welcome, I hope if somebody have a better solution! – m Peixoto Apr 8 at 14:48
  • So basically the answer is to create any Chatter post directly to the User, or @mentions would probably work in certain scenarios. – Adrian Larson Apr 8 at 16:32

You can achieve the bell notification through the new Summer '19 Custom Notifications feature however, it's not triggerable via APEX just yet. I know this doesn't directly answer the question re: APEX, but it's a pretty simple process builder.


Upside of this is that you can also deliver these as push notifications to the user's mobile device/watch etc. (so long as they have the Salesforce1 app installed).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.