1

I´m trying to update the visibility for feed items:

for (FeedItem FI: [SELECT id FROM FeedItem where Type = 'LinkPost' order by createddate desc]){
     FI.visibility='InternalUsers';
}

I get "EXCEPTION: System.SObjectException: Field is not writeable: FeedItem.Visibility"

Do you know how can i update the visibility field for feed items?

Can Salesforce support enable this?

  • could you post your entire code. I'm wondering why you would need to grant visiblity. Thanks – Blair Kristin May 27 '15 at 15:05
  • @BlairKristin, This sounds like an issue of permissions and a link being posted to something in a feed that members of that feed shouldn't have permission to see. – crmprogdev May 27 '15 at 15:11
  • Are you sure you can actually update the field? In the API docs it does not show the Update property. It just states that you can update it for record post (we may assume that you can't for LinkPost as you're trying to do?) salesforce.com/developer/docs/api/Content/… – MLucci May 27 '15 at 15:14
  • In Summer '15 (API v34.0), Update is supported. See my answer below. – alouie May 28 '15 at 4:51
1

In Summer '15, as part of the Edit Feed Posts and Comments feature, you'll be able to update FeedItem properties, including the Visibility. Here's the API documentation for FeedItem in Summer '15 (API v34.0). The FeedComment sObject is also supported. You can also edit feed items and comments in the Chatter REST API and Chatter in Apex.

  • I suspect that the Edit Chatter Feed Posts and Comments feature refers mostly to being able to edit their content and does not cover the Visibility field. Looking at the Summer 15 API docs linked in your answer at the row for Visibility there's no Update property defined. Exception to the field not being writable are then listed in notes below. Reading those notes it's unclear whether what the OP wants is achievable or not, a test run with APIv34 would remove any doubt. – MLucci Jun 6 '15 at 18:33
  • 1
    That's a good point. The visibility setting only applies to posts on records -- for users or groups, the visibility is always AllUsers. (I verified for myself via the SOAP API and got the error "User And Group Posts Cannot Be Set To InternalUsers For Visibility".) And the visibility can definitely be updated via the API for feed items posted to records if the feed editability feature is turned on. I work for Salesforce and will make sure that the documentation for the Visibility property gets updated. – alouie Jun 7 '15 at 5:53
0

It appears that all you can do is either transfer a feed or delete the feed. Anything else you'll need to do using permissions.

From the object reference:

FeedItem

FeedItem represents an entry in the feed, such as changes in a record feed, including text posts, link posts, and content posts. This object is available in API version 21.0 and later. This object replaces FeedPost.

Supported Calls

create(), delete(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search()

Special Access Rules

You can delete all feed items you created. To delete feed items you didn’t create, you must have one of these permissions:

  • “Modify All Data”
  • “Moderate Chatter”

“Manage Unlisted Groups”

Only users with this permission can delete items in unlisted groups.

Also:

  • If you use an Apex trigger to modify the Body of a FeedItem object, all mentions hyperlinks are converted to plain text and the mentioned users don't get email notifications.
  • update() is a supported call in Summer '15 (API v34.0). More details in my answer. – alouie May 28 '15 at 4:52
  • @alouie, that's helpful to know, but as we're still in Spring '15, he can't do that at present and will have to wait a month or more until his instance is updated to SU15. – crmprogdev May 28 '15 at 13:47
  • Yes, we'll need to wait for Summer '15. According to the release schedule, all instances will be upgraded by June 13, 2015. – alouie May 29 '15 at 1:31

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.