We have our Salesforce instance configured so that when a Task is created, this is posted to the Chatter feed:

example screenshot of "created a task" feeditem post

When I query for the feeditem created for that task creation event:

    Id, Body, InsertedById, IsRichText, LinkUrl, NetworkScope, ParentId,
    RelatedRecordId, Status, Title, Type, Visibility
FROM FeedItem

I can see the FeedItem with a Type = CreateRecordEvent, and a null Body, LinkUrl, and RelatedRecordId.

When I try to create something like this programmatically with Apex:

FeedItem item = new FeedItem(
    Type = 'CreateRecordEvent',
    createdById = 'MyUserId',
    ParentId = 'MY_TASK_ID_HERE',
    Visibility = 'AllUsers'

insert item;

The insert succeeds with no errors. I am able to then


And the new FeedItem is returned. However no chatter post is visible on the Account's chatter feed.

Why isn't this new FeedItem appearing on the Account's chatter feed?

Note the docs are either inconsistent or misleading, because for the Type field, they show a "CreatedRecordEvent" Type - note the Created with a d, vs the type created automatically is a type of CreateRecordEvent.

If this is impossible, which it seems to be, how could I mimic the "created a record" Chatter post to link to a record ID so that it opens in a subtab and follows the same behavior as a record link?

When I try to make a Type = "LinkPost" and set LinkUrl = URL.getSalesforceBaseUrl().toExternalForm() + '/' + MY_TASK_ID, or do the same thing with a post body and an <a> tag, the link opens in a new tab.

1 Answer 1


My first expectation is that the feed item would be that the feed item would require a reference to the record in which the item should be displayed and a reference to the record that was created.

The record we want to display the item on is the parent Id.

It might be tempting to assume that relatedRecordId is the latter; however, this field points only to ContentVersion on content posts and is null otherwise. Looking through the documentation there are no other fields that I would expect

This is when I look at the WSDL. The WSDL has a tendency to include some fields that SFDC doesn't document or want you to know about. Note: this doesn't always mean you can use the fields, just that it helps illuminate them somtimes:

<complexType name="FeedItem">
        <extension base="ens:sObject">
            <element name="AuditableEntities" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="CreatedBy" nillable="true" minOccurs="0" type="ens:sObject"/>
            <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="FeedAttachments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedComments" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedItemThanks" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedLikes" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedRevisions" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedSignals" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="FeedTrackedChanges" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="InsertedBy" nillable="true" minOccurs="0" type="ens:sObject"/>
            <element name="InsertedById" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="LastEditById" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="NetworkUserHistoryRecentToFeedItem" nillable="true" minOccurs="0" type="tns:QueryResult"/>
            <element name="Parent" nillable="true" minOccurs="0" type="ens:sObject"/>
            <element name="ParentId" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="RelatedRecordId" nillable="true" minOccurs="0" type="tns:ID"/>
            <element name="TopicAssignments" nillable="true" minOccurs="0" type="tns:QueryResult"/>

This is a trimmed down version of thw WSDL were I only include the relationships available to the feed item. In theory you could test all of these relationships to see if they work. I tested TopicAssignments and AuditableEntities and neither field is editable. I also tested adding a LinkUrl jsut to see if that would work and that field is not valid for the type CreateRecordEvent.


I don't think its possible to do what you need to do.

  • If I can't create that specific type of feed event, what about the second question, which is can I make a record link in the chatter post somehow that links to the record in the same window?
    – Andy Ray
    Feb 20, 2020 at 22:29
  • Sorry I don't have an answer to that. I do generally try to recommend avoiding two questions in one whenever possible.
    – gNerb
    Feb 20, 2020 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .