I have a custom object (badge) , it has a imageUrl field which is the public url for the image. I have a formula field called Thumbnail which uses IMAGE function to use the imageUrl to display the image in the detail page for the object.

How can i use either the imageUrl or Thumbnail to post a chatter feed using the FeedItem object usng Apex ?

sObject fItem = (sObject)System.Type.forName('FeedItem').newInstance();
   fitem.put('ParentId' ,UserInfo.getUserId()); 
    fItem.put('Body' , UserInfo.getName()+' won a badge. <apex:image url="'+badge.Image_Url__c+'" />' );

1 Answer 1


I didnt find any direct way to embed image into a post but ended up posting the image as attachment, got the answer from this post: https://success.salesforce.com/answers?id=90630000000hahYAAQ

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.