I have a custom object named 'comments' with which i made a 'action'.it is having a trigger handler class
public void onAfterInsert(Comments__c[] newComments) { if (newComments.size() > 0) { for (Comments__c comRec : newComments) { FeedItem post = new FeedItem(); post.ParentId = comRec.case__c; post.IsRichText = true; post.body = comRec.Case_Comments__c; feedItemInsertList.add(post); try { if (feedItemInsertList.size() > 0) { insert post; } } catch (Exception e) { system.debug(e.getMessage()); } }
the 'case comments' field is a rich text but when i add a image to it in case feed it is creating a comment but I was not able to view the image in feed but in detail page the image is available.It was throwing an error
System.DmlException: Insert failed. First exception on row 0; firsterror: INVALID_CROSS_REFERENCE_KEY, Referenced file id is invalid, notaccessible, or does not exist: [RawBody]