+ Start a Discussion
Btuitasi1Btuitasi1 

How to create or recreate promote button on visualforce page

I have a html customized visualforce page that displays idea records. I have successfully implemented everything, except for the promote/demote buttons. How would I put that in my page under each record displayed? I've searched the documentation, but haven't had any success. 

Any help would be much appreciated!

Thanks!

 
Best Answer chosen by Btuitasi1
Wizno @ ConfigeroWizno @ Configero
In that case, the Votes object is exactly what you need. 

Votes has a property called "Type", which accepts "Up" or "Down" as a value. Thumbs Up => "Up", Thumbs Down => "Down", And Votes.ParentId = Idea.Id. Just add that little bit of logic into your controller and it'll work just fine :-)

All Answers

Wizno @ ConfigeroWizno @ Configero
Are you trying to figure out which sObject to use to store votes?

if so, it's called "Votes": http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_vote.htm
Btuitasi1Btuitasi1
Currently, I have two buttons: thumbs up (up vote) and thumbs down (down vote). I am trying to figure out how to map that to the Idea promote/demote feature. Or, if I could just use the promote/demote button already included on the Idea tab in my own visualforce page. 
Wizno @ ConfigeroWizno @ Configero
In that case, the Votes object is exactly what you need. 

Votes has a property called "Type", which accepts "Up" or "Down" as a value. Thumbs Up => "Up", Thumbs Down => "Down", And Votes.ParentId = Idea.Id. Just add that little bit of logic into your controller and it'll work just fine :-)
This was selected as the best answer
Btuitasi1Btuitasi1
Here's what I have so far:
 
//VF Page Sample

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

//Extension
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;
}



}
}
I'm having trouble constructing the extension. 
 
ab84ab84
Did you ever get this to work?  I'm trying to do something similar but get the error below:

Compile Error: Illegal assignment from Schema.SObjectField to Id

This points to the line:
setVote.ParentId=Idea.Id;