How to add a hyperlink in the body of a feeditem using apex class?

FeedItem in salesforce as its represents an entry in the feed, such as changes in a record feed, including text posts, link posts, and content posts.

Sample Code:
//Adding a Link in FeedItem
FeedItem linkItem = new FeedItem();
linkItem.ParentId = oId; //eg. Account id, Contact Id, Opportunity id, Custom object id, etc
linkItem.Title = ‘’;
linkItem.LinkUrl = ‘’;
insert linkItem;

See the Screenshot:


Written by 

Salesforce MVP | Lightning Champion | 17x Salesforce Certified | Application Architect | 7x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *