+ Start a Discussion
Tomas.RayTomas.Ray 

Post a chatter feed with auxiliary body from apex

Hi everyone,

I have a requirement to post a chatter feed on case feed stream and chatter tab, when a specific task was created under a case.

I know how to post a txt msg from apex code, but I am wondering how to post a chatter feed with auxiliary body as below

User-added image

Appreciate if you have any idea.

Regards,
Thomas
AnjithKumarAnjithKumar
Dear Tomas,

Its standard feature when ever you create a Task then it will post a feed on parent record's feed. You have to enable all related objects feed on case object.

User-added image
ActivityEvent—indirectly generated event when a user or the API adds a Task associated with a feed-enabled parent record (excluding email tasks on cases). Also occurs when a user or the APIadds or updates a Task or Event associated with a case record (excluding email and call logging).
For a recurring Task with CaseFeed disabled, one event is generated for the series only. For a recurring Task with CaseFeed enabled, events are generated for the series and each occurrence.

If you still want to create this from code then disable this feature .

check the following link for types of posts.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_feeditem.htm

let me know if you need help.

Thanks,
Anjith kumar.