You need to sign in to do that
Don't have an account?
Chatter Workbook - Query Not Working
Hi, I am trying following code from the Chatter workbook but it is throwing error below. Any suggestion?
private static void displayNewsFeed() throws Exception {
System.out.println("Querying for status updates...");
QueryResult queryResults = connection.query
("SELECT Id, Type, CreatedDate, CreatedBy.name, Body FROM NewsFeed WHERE Type= 'UserStatus' ORDER BY CreatedDate DESC, ID DESC LIMIT 10");
if (queryResults.getSize() > 0) {
for (SObject s : queryResults.getRecords()) {
System.out.println(s.getChild("NewsFeed").getField("Body") );
}
}
}
^
Exception in thread "main" [InvalidFieldFault [ApiQueryFault [ApiFault exceptionCode='INVALID_FIELD'
exceptionMessage='
CreatedDate, CreatedBy.name, Body FROM NewsFeed WHERE Type= 'UserStatus'
ERROR at Row:1:Column:47
No such column 'Body' on entity 'NewsFeed'. 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.'
]
row='1'
column='47'
]
]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(
Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sforce.ws.bind.TypeMapper.readSingle(
TypeMapper.java:627)
at com.sforce.ws.bind.TypeMapper.readObject(
TypeMapper.java:504)
at com.sforce.ws.transport.SoapConnection.parseDetail(
SoapConnection.java:226)
at com.sforce.ws.transport.SoapConnection.createException(
SoapConnection.java:200)
at com.sforce.ws.transport.SoapConnection.receive(
SoapConnection.java:146)
at com.sforce.ws.transport.SoapConnection.send(
SoapConnection.java:98)
at com.sforce.soap.partner.PartnerConnection.query(
PartnerConnection.java:1158)
at com.developerforce.chatter.ChatterMain.displayNewsFeed(
ChatterMain.java:65)
at com.developerforce.chatter.ChatterMain.main(
ChatterMain.java:35)
Hi,
I'm not very familiarize with Chatter, but I have just seen a post which seems to be similar than yours and the problem is fixed.
The Subject is: Custom Object Feed issue. http://boards.developerforce.com/t5/Chatter-and-Chatter-API/Custom-Object-Feed-issue/td-p/318737
It also sounds like you may be using an old version of the API. Make sure you are using at least v22