function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
AkshoyAkshoy 

How do I capture the files published in feed using apex.

I want to add a custom button to a FeedItem of type "ContentPost" before insert, to capture the file by cliking that button. is it possible?

please suggest if any other way to do this...

please help....

Salesforce SolutionsSalesforce Solutions

Can you provide more detail of what you are trying to do?

If you want to capture the details of a file when it is uploaded, you could create a trigger, e.g.

 

trigger t on FeedItem (before insert) {

    FeedItem[] contentFeeds;
    
    contentFeeds = 
	[SELECT ID, ContentFileName, Title, ContentSize, ContentType,
	CreatedById, CreatedBy.Name, CreatedDate,
	LastModifiedDate, RelatedRecordId,
	Type, ParentId, Parent.Name, Parent.Type
	FROM FeedItem
	WHERE ID IN :Trigger.new AND Type = 'ContentPost'];
    if (!contentFeeds.IsEmpty()) {
        // iterate all feed items and do something
        for (FeedItem fi: contentFeeds) {                                
             //do something           
        }
    }
}

 

 

AkshoyAkshoy

Thanks for your help.

 

As we know documents / files can be present in chatter / account / opportunity etc in salesforce. I want to get a specific file / document programetically. For that I need to add a button / link which will trigger an action to get that file /document. I want to put the button / link beside the file / document.

 

For example:

Lets assume, a feedItem of type ContentPost is present in feed area. So, a file / document is present in that feed. I want to add a button / link beside that file / document. By clicking that button / link I will get the file / document so I can do the work with that file /document.

 

Please suggest.

 

 

AkshoyAkshoy

Hi Salesforce Solutions,

Is there any solution do you have regarding my post?

Do you need any more clarification regarding this?

 

Thanks

Akshoy