Pages

Monday, April 18, 2016

Chatter Poll: How to Get the Detail?

Chatter Poll is a nice feature for Salesforce and Chatter user to do simple poll.


Use Case: Universal Container conducting a poll in a Chatter Group 'All Employee' and would like all employee to vote on a product name.

Issue: we only see the vote result for each choice and total user has vote, but we do not know who has vote and has not vote.

Solutions:
  • There is no report type for Chatter Poll :(
  • To write apex code for this --- we have no in house developer :(
  • SOQL --- this is possible :)

So here we go, you can use developer workbench to run this query:

1. Query FeedItem 
First. we need to find FeedItemId to get the Id of the poll feed.
Example: SELECT Id, Body FROM FeedItem ORDER BY CreatedDate DESC




2. Query FeedPollVote 
Second, query FeedPollVote to know who has vote on that poll / feed, so in this case, looks for CreatedById.
Example: SELECT Id, CreatedById, CreatedDate, ChoiceId FROM FeedPollVote Where FeedItemId = '0D590000037CHTSCA4'



3. Query FeedPollChoice (Optional)
This query only needed if you would like to know which choice is voted by each users.
Example: SELECT Id, ChoiceBody FROM FeedPollChoice Where FeedItemId = '0D590000037CHTSCA4'


From last query we know that user 00590000000OoB0AAK vote for Strawberry and 00590000000YIE2AAO vote for Banana.

So, if you would like to know who has not vote, just export 2nd query and look for CreatedById, using Ms Excel and do a simple VLOOKUP() to compare will all Salesforce / Chatter users.





No comments:

Post a Comment

Page-level ad