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
HugoNowHugoNow 

Connect API - postFeedElement - Implementation restriction exception

Hi all,
I am having quite a bizarre problem.

I have code inside of a trigger that does a Chatter post when a condition is met.
ConnectApi.ChatterFeeds.postFeedElement(Network.getNetworkId(), 'me', 
			ConnectApi.FeedElementType.FeedItem, 'It is ready!');

When executed by an admin, everything is okay. But when it is executed by a user with a Chatter Only license, I get the error:

ConnectApi.ConnectApiException: FeedItemContentRevisionControl: execution of BeforeInsert caused by: System.QueryException: Implementation restriction: FeedItem requires a filter by Id Trigger.FeedItemContentRevisionControl: line 52, column 1 Class.ConnectApi.ChatterFeeds.postFeedItem: line 6395, column 1 

However, when I bypass the ConnectApi and insert directly a FeedItem, it works
INSERT new FeedItem(ParentId = UserInfo.getUserId(), Body = 'It is ready!');
I have searched around and I am not able to find a solution for this. I would like to use the ConnectApi as I have requirements for its features that I cannot do through an insert of the FeedItem.

I tried removing the 'with sharing'. I tried adding 'without sharing'. I upgraded my version to v35. I tried replacing the 'me' with UserInfo.getUserId(). I tried to find if there was a permission or configuration associated but to no avail.

Anyone has ideas about this? It this a bug?

Thanks

 
ArmouryArmoury
I just tested the same connectapi code in the feedItem trigger. So whenever I post a feed - the code runs fine and a new post with the body 'It Is ready' is added to the chatter. This worked for both Sys Admin and for the standard chatter free profile user. 
Have you checked any other system permission is required to setup in the profile for the line which is throwing the exception?