You need to sign in to do that
Don't have an account?
Btuitasi1
Idea voting extension on VF page
I'm trying to use custom buttons to set the Vote object as "Up" or "Down". I have the buttons up, but I'm having trouble with the beginning part of the extension. I am still fairly new to apex.
Any help would be appreciated!
VF Page Sample
Extension so far
Any help would be appreciated!
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 so far
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; } } }
http://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_vote.htm
I think you need to insert Vote record after setting Type and Parent id. Can you please try to insert setVote on the next line of setvote.ParentId = Idea.Id;
Please try and let me know if you still face any issue.
If this post is your solution, kindly mark this as the solution to the post so that others may benefit.
Regards,
Praful G.