How to create a voting feature for your records

Here’s a way to setup a voting feature in Stacker using action buttons in a list layout. A word of warning, it’s not a scalable solution but nonetheless fun for a proof of concept :slight_smile:

Upvote

Downvote

Voting in action (the confirmation modal will still come up and you will need to save the action but pretty soon it looks like that would no longer be a problem! → Ability to skip the confirmation modal | Voters | Stacker
CleanShot 2023-04-21 at 15.25.03

Brief description on how to achieve this:

  1. Create a role for each person with their name (this is so that you know who voted) e.g. ‘Katie-User’
  2. Create a new field of type ‘Checkbox’ for each person’s vote. E.g. ‘Katie Vote’
  3. Create 2 action buttons for each person - name the buttons with the name of the person so that it’s easy to target them using CSS later. e.g. ‘Katie Vote Up’, ‘Katie Vote Down’
    a. Configure the default value for the ‘Vote Up’ action button to ‘checked’
    b. Configure the conditions of the ‘Vote Up’ action button to only show when ‘Katie Vote’ is False and ‘User Role’ is ‘Katie-User’
    Do the same for the ‘Vote Down’ button by switching the conditions
  4. Assign the user with the new role and they can now do some voting for the records in your list layout

To get the thumbs up / thumbs down emoji, refer to my tip on using CSS to change your action button from text to a svg image.

You can also tally up the votes for a record by creating a formula field and adding up the votes that are checked with IF statements

I hope you enjoy this tip!

3 Likes