Skip to main content
vetriselvan manoharan (Wilco Source) 님이 #Apex에 질문했습니다
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.
답변 1개
  1. 2015년 6월 1일 오후 9:08
    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)