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
ab84ab84 

Vote up and down on idea object

I'm replacing the ideas page with a custom VF page.  I have everything working apart from the vote up and down buttons.

Has anyone else done this and able to assist in getting the buttons working?  I have a look at this thread (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AsPHIA0)with the same question but there was no resolution.
Praful GadgePraful Gadge
Hi Brother!

I just replied to the post you shared above (https://developer.salesforce.com/forums/ForumsMain?id=906F0000000AsPHIA0). it seems he forgot to add insert statement after setting up idea and vote type oin Vote object.;

Can you please try the same 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.
ab84ab84
Hi Praful,

Thanks for the reply.

Do you mean:
public void setValue1() {
    setVote.Type='Up';
    setVote.ParentId=Idea.Id;
    insert setVote;
    }

If so this shows the error Illegal assignment from Schema.SObjectField to Id at line 89 column 5.  Line 89 is highlighted bold above.

 
Praful GadgePraful Gadge
You should use Id of the Idea record, for which user wants to vote. Not directly Idea.Id.
ab84ab84
How would I do that?
Praful GadgePraful Gadge
Hi AB!!

How do you identify/select idea which User wants to vote for? 
Is there any UI/VF page on which you are displaying ideas and then User votes for it?