Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Chatter Development
- :
- Get profile images from feed query
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Get profile images from feed query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-30-2012 05:49 PM
It's great that we can get profile urls using the fields on the User object. The problem is they don't seem to be assible from a feed query. So if I have a custom object Custom__c and I turn chatter on for it then try and get the feed with a query to Custom__Feed in apex. I can't access the profile images for the posts with CreatedBy.smallPhotoUrl because I get the following error:
No such column 'smallPhotoUrl' on entity 'Name'
So my question is, is there anyway to get the photo urls for the feed items in a single query or are we destined to do multiple queries and create wrapper classes to include the small photo urls :( I would really like to avoid this.
Re: Get profile images from feed query
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2012 10:51 PM - edited 12-02-2012 10:52 PM
Yeah, you can't get smallPhotoUrl directly from Chatter object, but add only one SOQL will be fine, if you don't have too many users in the org. Like this,
AccountFeed af = [select id, createdbyid from AccountFeed limit 1];
Map<Id, User> usermap = new Map<Id, User>([select Id, smallPhotoUrl from user]);
System.debug(' --------- ' + usermap.get(af.createdbyid).smallPhotoUrl ) ;
If you got the createdbyid of the post, then you can get this user's photo link from the Map.
Re: Get profile images from feed query
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-02-2012 11:11 PM
Hello Scott,
SmallPhotoUrl gives the User Thumbnail Profile photo, which is available only in API version 20.0 and in later versions.
If you are using the query in AJAX, make sure you use API Version above 20 as below,
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
If you are using the query in VF page, make sure the VF page version is above 20.
You can refer this LINK
Regards,
Bharathi
Salesforce For All
Mrk this post as solved, if it helps you

