Can you access chatter Poll choices or poll votes?

When you create a chatter poll you create the poll choices separately so these are most likely a separate Sobject.

Is there any way to access either the choices in the poll or the votes for a particular choice?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Poll votes are not currently exposed and most likely never will be since if these objects were exposed there would be no way to keep the votes anonymous. See this idea for the option to create polls with public vs. private votes.

Poll choices are stored in the FeedPollChoice Sobject. However, this is only accessible through the chatter REST api. You can’t even get describe information for this object through apex or the metadata api.

Method 2

If you use the new Chatter in Apex feature (formerly “Connect in Apex”) that is available in dev preview in Spring 13 and is expected to GA in Summer 13 you can:

  • post feed polls: ConnectApi.ChatterFeeds.postFeedItem(community id, feed type, subject id, FeedItemInput including poll info, null)
  • get information about polls (choices and results, not individual votes): ConnectApi.ChatterFeeds.getFeedPoll(community id, feed item id) / ConnectApi.ChatterFeeds.getFeedItem(community id, feed item id)
  • vote on polls: ConnectApi.ChatterFeeds.voteOnFeedPoll(community id, feed item id, choice id)

Spring 13 dev preview doc is in here: http://www.salesforce.com/us/developer/docs/chatterapi/index.htm

Method 3

If you don’t need an automated way to get the results, you can simply access them in the database, via the Developer Console for instance. Get your desired FeedPollChoice entries by the FeedItemId corresponding to the FeedItem that represents your question. Then link each FeedPollChoice to all the FeedPollVotes by ChoiceId. FeedPollVote.CreatedById is the ID of the user who submitted the vote, so you can link that to the User table to get names.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x