Quantcast
Channel: Active questions tagged feeditem - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 160

Attachments in FeedItem After Insert Trigger

$
0
0

I'm trying to get the attachments from a FeedItem after insert trigger, but it does not return all the associated attachments. I understand attachments are inserted after the FeedItem is inserted (ref.), but I am able to get the first attachment (and only the first attachment) in the after insert trigger. Is there any way to get all related attachments of a FeedItem in an after insert trigger?

On the high level - I am trying to convert regular posts to a specific CollaborationGroup to a Question, which I am handling with after insert trigger. While the post gets converted to Question, I am unable to pass its attachments. Any suggestions?

EDIT - Added code shippet.

Trigger:

trigger FeedItemTrigger on FeedItem (after insert) {
    List<Id> feedItemIds = new List<Id>();
    for(FeedItem fi : Trigger.New){
        feedItemIds.add(fi.Id);
    }
    List<FeedAttachment> attachments =  [SELECT Id, Title, Type, FeedEntityId FROM FeedAttachment WHERE FeedEntityId IN :feedItemIds];
    System.debug('attachments count :: '+attachments.size());
}

Chatter Post: Chatter Post

This gives gets me only one attachment from the FeedItem.


Viewing all articles
Browse latest Browse all 160

Trending Articles


FLASHBACK WITH SIRASA FM AT GALGAMUWA 2022


Mp3 Download: Mdu - Mazola


Imitation gun was fired at motorist in Leicester road-rage incident


Ndebele names


MCKINNEY EMALINE “EMMA” OF WES...


Okra & Motia — The Workshop (Prod by Hammer)


Skint TV teen to be sentenced


Moondru Mudichu 19-09-2017 – Polimer tv Serial


YOSVANI JAMES Arrested by Miami-Dade County Corrections on Jan 10, 2017


Stories • Goddess Stepmom



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>