1

Is it possible to write SOQL to display the Last Name and Choice of a user who participated in a Chatter poll. I have the following SOQL so far. I want the actual choice not the choice id.

SELECT id, LastName FROM User
             where id in (select CREATEDBYID from feedpollvote)

1 Answer 1

3

Sure.

SELECT CreatedBy.LastName, Choice.ChoiceBody from FeedPollVote

This yields one row per poll vote, including the last name of the user and the full text of the choice selected.

The relationships for this object are documented under FeedPollVote (I like to look at the SOAP API reference as it often includes more detail than the object reference). ChoiceId is a reference to FeedPollChoice, so relationships are accessed through Choice., and the relevant field names for that object are on FeedPollChoice (also part of the SOAP API reference).

2
  • Can you tell me how you knew that CreatedBy.LastName and Choice.ChoiceBody were options to use in the query? I am not seeing that in the documentation that I see online. I feel like I am missing an important resource. Thanks. Commented Dec 7, 2018 at 18:18
  • Absolutely, I should have included that in the first place. Thanks for asking; see the links I've added.
    – David Reed
    Commented Dec 7, 2018 at 18:25

You must log in to answer this question.

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