I'm trying to create a chatter post via Apex. The problem I'm facing with is the visibility in the partner community. The user mentioned remains highlighted in Gray.

In the FeedItem record what I can see is that NetworkScope is correctly set to "AllNetworks" but Visibility is set to "InternalUsers" instead of "AllUsers".

Does anyone know how I can make visibility set to "AllUser" ?


  • Can you share the code so that we can help*? – Mohith Shrivastava Dec 14 '15 at 11:46

I'm assuming that you're using the ConnectApiHelper class. It's not officially supported by Salesforce, although it was initially written by me (I'm a Salesforce employee).

Currently there isn't an option to control the visibility, but since the source code is available, it's easy to add. Look for the code that creates the ConnectApi.FeedItemInput:

ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
input.body = messageInput;
input.subjectId = subjectId;

You'll want to add a parameter that lets you specify the ConnectApi.FeedItemVisibilityType. It can be either ConnectApi.FeedItemVisibilityType.InternalUsers (the default) or ConnectApi.FeedItemVisibilityType.AllUsers.

input.visibility = your_new_parameter

Here are the Apex docs about ConnectApi.FeedItemVisibilityType and ConnectApi.FeedItemInput.

I added this as an issue in the ConnectApiHelper GitHub repo. I'll address it when I have some free time, unless someone beats me to it. (Feel free to send a pull request my way!)

|improve this answer|||||
  • Thanks @alouie this solved my problem. Unfortunately now I'm facing with a new problem. If the Apex code had been triggered by a partner community user I got an Error: "System.NoAccessException". – Slamtt Dec 16 '15 at 14:38
  • Are you passing in the community ID as the first parameter to ConnectApiHelper.postFeedItemWithMentions()? If so, how are you getting the community ID? – alouie Dec 16 '15 at 18:19
  • This is the query I use to get the community Id: >Network nw = [SELECT Id FROM Network WHERE Name = 'XYZ' Limit 1]; >String CommId = String.ValueOf(nw.Id); >ConnectApiHelper.postFeedItemWithMentions(CommId,'701260000006CKb','{00526000000Fww9} ti è stato assegnato un nuovo task.'); – Slamtt Dec 18 '15 at 8:32
  • That looks good to me. I'd double-check that the partner community user has access to both the campaign record (701260000006CKb) and the community (XYZ). – alouie Dec 18 '15 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.