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
Suma G 7Suma G 7 

Vote buttons on Ideas

Hi,

i have to add vote up & vote down buttons on Idea object. is can be done in standard way? or i have to go for custom functionalty?  Anyone can help me on this.

Thanks in advance!

Regards,
Suma.
NagendraNagendra (Salesforce Developers) 
Hi Suma,

Please find the below sample code snippet which might help you accelerate further with above requirement.

Visual Force Page:
<apex:form >
                   <apex:commandButton styleclass="btn-lg btn-data" value="Vote Up" action="{!setValue1}"/>
                   <apex:commandButton styleclass="btn-lg btn-data" value="Vote Down" action="{!setValue2}"/>
                   </apex:form>
Apex Controller:
public class detailExt{
public myControllerExtension(ApexPages.StandardController stdController) {
         public Vote setVote {get; set;}

public void setValue1() {
    setVote.Type = 'Up';
    setVote.ParentId = Idea.Id;
}
public void setValue1() {
    setVote.Type = 'Down';
    setVote.ParentId = Idea.Id;
Insert setVote;
}
}
}
Note: You should use Id of the Idea record, for which user wants to vote. Not directly Idea.Id.

Hope this helps.

Please mark this as solved if my reply was helpful so that others can benefit who are encountering a similar issue.

Thanks,
Nagendra.

 
Suma G 7Suma G 7
Hi Nagendra,

Thankyou for your reply.
can you give me the entire code for vf and apex. i worked on it. still am getting some issues to save the file itself.

thanks,
suma.