You need to sign in to do that
Don't have an account?

Help with Feeditem Trigger
All, I was wondering if someone can help me. Below is my trigger which is very simple. It will take Feed item from Account page and will repost it to Chatter group. Trigger works fine for Post and Link, but when I`m trying to attach exisitng File from content library and share it, it generates below error.
Field_Integrity_Exception, ContentFileName is required field for feed post of type ContentPost. Content File Name: [ContentFileName]
Can someone pls suggest a workaround?
Field_Integrity_Exception, ContentFileName is required field for feed post of type ContentPost. Content File Name: [ContentFileName]
Can someone pls suggest a workaround?
trigger autoPostFromAccToGroup on FeedItem (before insert) { List <FeedItem> Feedlist = New List <FeedItem> (); Map <id,Account> AccMaps = New Map <id, Account> () ; Set <Id> idsets = New Set <Id> (); For (Feeditem fe : Trigger.New) { String idStr = fe.Parentid; if(idStr.startsWith('001')){ idsets.add(idStr); } } List <Account> accs = [SELECT ID, Owner.Name, RecordTypeid, Name FROM Account WHERE id IN :idsets ]; for (Account acc : accs) { AccMaps.put(acc.id,acc); for (Feeditem f : Trigger.New) { if (AccMaps.get(f.parentid).Recordtypeid == '012300000000uth') { FeedItem FI = New FeedItem (); FI.ParentId = '0F91b0000008ThRCAU' ; FI.TYPE = F.TYPE; Fi.IsRichText = True; FI.Body = F.Body; Fi.LINKURL = F.LINKURL; Fi.TITLE = F.TITLE; Fi.ContentFileName = F.ContentFileName; Fi.ContentData = F.ContentData ; Fi.ContentDescription= F.ContentDescription; Fi.CreatedByid = UserInfo.getUserId() ; Feedlist.add(FI); } } } insert Feedlist; }
"Field_Integrity_Exception, ContentFileName is required field for feed post of type ContentPost. Content File Name: [ContentFileName]". Wierd thing is, I only get this error while referning file from content library. I dont get any error when I upload new file.
Use like this snippt from line 37 to 39 .. Regards
Tej Pal Kumawat
Skype : tejpalkumawat1991
If this answers your question mark Best Answer it as solution and then hit Like!
@Jaap - Any idea how I can retrieve File content?