I'm coding a trigger for "FeedItem" to automatically add a mention to a certain user.

I'm following pretty much the same logic stated here (by adding a new mention segment to the feed input):


When calling ConnectAPI.updateFeedElement from the trigger, the mention is successfully added; however for some weird reason the mentioned user receives 2 email notifications instead of one.

If the same logic is applied outside of a trigger (running from anonymous for example) the user receives only 1 notification.

Any ideas?

  • 2
    I'm seeing this in an "after insert" FeedItem trigger too. I think that both the insert and the update are causing email notifications to be sent. I work at Salesforce and am checking with the team to see what we can do. If you need to contact support, please reference work record W-2840463. – alouie Nov 24 '15 at 21:49
  • 2
    @alouie I've already opened a case (12798629), it seems like a Salesforce bug. Will update here with the findings. Thank you – jonathanwiesel Nov 25 '15 at 8:33
  • @alouie was there ever an update on this issue? I'm also seeing this exact issue. – John_Henry Oct 19 '16 at 16:02
  • 1
    @John_Yankee, unfortunately there wasn't a fix. – alouie Oct 20 '16 at 22:15

I struggled with this as well. According to Salesforce, this is 'working as designed.' You must put your logic in a future method if you are adding mentions in an after insert trigger. https://help.salesforce.com/articleView?id=000321239&language=en_US&type=1&mode=1

In my experience, though, even doing this sometimes causes duplicate emails to be sent, seemingly randomly. At least I cannot find a pattern.

| improve this answer | |

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.