0

When I'm trying to do e.g. in either code or the Developer Console

SELECT Id, Type, Body, Title, ContentData From FeedItem where Type = 'ContentPost' LIMIT 1

I get

No such column 'ContentData' on entity 'FeedItem'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

And indeed when I click 'Open Resource' and then FeedItem I somehow don't see the ContentData field being listed... Anybody an idea why not or what I do wrong?

1 Answer 1

2

As per the doc

This field only Available in API version 35.0 and earlier only.

Available in API version 35.0 and earlier only. This field is required if Type is ContentPost. Encoded file data in any format, and can’t be 0 bytes. Setting this field automatically sets Type to ContentPost.

Since you are using Developer console.. I think this query performed in latest API(i.e. 36v )

The proper way to do this in v36 is to first create a FeedItem, but without any ContentData, i.e. an empty FeedItem. Then create a ContentVersion with VersionData (which under water creates a ContentDocument). Then create a FeedAttachment that relates the created ContentDocument to the FeedItem. It's a bit of a hassle, but it works.

11
  • So... how are we supposed to query that data in API v36? Thanks! Commented Mar 8, 2016 at 10:47
  • @WillemMulder I am not sure.. If you want to use this field in apex class just change the API version...
    – Ratan Paul
    Commented Mar 8, 2016 at 10:50
  • 1
    upon further inspection it appears there is now "FeedAttachment" which is a junction record between ContentDocument and a FeedItem. I'm going to try to get that to work; then report back. Commented Mar 8, 2016 at 11:02
  • So I got it to work, and updated the answer to explain what needs doing. It's not as easy as I hoped though :-) Commented Mar 8, 2016 at 12:08
  • @WillemMulder Thanks.. Really good you solved your own issue.
    – Ratan Paul
    Commented Mar 8, 2016 at 12:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .