1

Hey guys I'm having an issue getting my first inner select working and just haven't gotten it to work no matter what I've tried. Does anyone see why I can't select User.Name, User.Email and User.SmallPhotoUrl? I would just use CreatedBy, but the issue is that the SObject NAME does not provide SmallPhotoUrl =(

I get errors like this

MALFORMED_QUERY: FeedComment.CreatedBy.ProfileId = Users.ProfileId ^ ERROR at Row:13:Column:72 unexpected token: 'Users.ProfileId'

SELECT 
Id, 
Type, 
ParentId, 
RelatedRecordId, 
(
    SELECT
    Name,
    Email,
    SmallPhotoUrl
    FROM Users
    WHERE 
    (
        Users.ProfileId = UserFeed.CreatedBy.ProfileId
    )
)

Title, 
Body, 
CommentCount, 
LikeCount, 
LinkUrl, 
ContentFileName, 
ContentDescription, 
ContentType, 
ContentSize, 
CreatedDate, 
LastModifiedDate,
(
    SELECT 
          Id, 
          FeedItemId, 
          ParentId,
          CommentBody, 
          CommentType, 
          RelatedRecordId, 
          CreatedDate
    FROM FeedComments 
    ORDER BY CreatedDate ASC
)

FROM UserFeed
WHERE (
    (
        ParentId = '005i0000000ZeaDAAS'
    )

AND ( 
        LastModifiedDate > 2013-05-31T20:28:42.000000Z 
    )

AND Type IN (
              'TextPost', 
              'LinkPost', 
              'ContentPost'
            )
)

OR (
    (
        CommentCount > 0 
    )

AND ( 
        CreatedDate > 2013-05-31T20:28:42.000000Z 
    )

AND Type IN (
              'TextPost', 
              'LinkPost', 
              'ContentPost'
            )
)

ORDER BY CreatedDate DESC
  • Maybe write what you're after? UserFeed doesn't have a related list called Users (in other words - you can remove the first WHERE clause and it'll keep on failing). FeedComments, FeedLikes and FeedTrackedChanges are available. Have you seen salesforce.com/us/developer/docs/api/Content/… ? – eyescream Jun 3 '13 at 18:59
  • 3
    Maybe you want to go "up" instead of "down"? SELECT Id, Type, ParentId, RelatedRecordId, Parent.Name, Parent.Email, Parent.SmallPhotoUrl, (...) FROM UserFeed? – eyescream Jun 3 '13 at 19:06
  • I ended up runnig a second query to select from user after obtaining Name.Username not perfect but it hacks out ok – ehime Jun 4 '13 at 15:25
  • I'm voting to close this question as off-topic because it appears to be abandoned. – Adrian Larson Jun 15 '17 at 11:35
  • @AdrianLarson not abandoned, just no one ever came up with an acceptable answer – ehime Jun 16 '17 at 4:17

Browse other questions tagged or ask your own question.