function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vetriselvan ManoharanVetriselvan Manoharan 

Check if the user has voted on Ideas

Hi,

I am working on Idea Exchange. Currently I need to show the Promote and Demote button only if the user has not voted for the idea before. How to achieve it? Is there any flags available for it. Please help me out.
Praful GadgePraful Gadge
Hi Vetriselvan,

Whenever User votes for any idea a new Vote object record gets created with that User.

You can simply query like -1
Select Id from Vote Where ParentId =: ideaId AND CreatedById =: UserId
If this query returns any record it means User has already voted for that Idea. Please refer this Idea object reference (https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_vote.htm).

If this post is your solution, kindly mark this as the solution to the post so that others may benefit.

Regards,
Praful Gadge.
LinkedIn (https://in.linkedin.com/in/prafulgadge)
Tweets (https://www.twitter.com/prafulgadge)