function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vasu takasivasu takasi 

how to insert a feedItem from trigger

the beloecode showing exception like

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

 

trigger acc on FeedItem (after insert)
{
FeedItem post = new FeedItem();
post.ParentId ='0019000000GuVUM';
post.Body = 'welcome';

Database.insert(post);
}

 

 

 

How to solve it.

Scott_VSScott_VS

Your code is correct.

 

Does the user have permission to write on the chatter feed for the ParentId you have hard coded?

vasu takasivasu takasi

how to check user permissions..?

please give me reply.

Scott_VSScott_VS

Go to the page for 0019000000GuVUM and see if you can post to that chatter feed.