Forum Discussion
Create a Voting feature in a List?
To turn it on, in your List, click on the Gear Icon -> List settings -> Rating settings, turn on Ratings and select Likes or Star voting.
- Cesar_LimaAug 29, 2023Copper ContributorEngineerTony, this helped me solving my problem. There's only a pitfall here, if you start building your list from Teams. You can only change those settings (or even see the gear icon) if you open your list on SharePoint online. Teams doesn't allow you to get to the same level of settings -- a bit counter-intuitive, but it works.
Thanks for sharing this!- ScottAtWorkJan 30, 2024Copper Contributor
Stumbled here looking for the same issue. SP Rating system (where Like or Star) does exactly what I need, but running into two issues:
1. Casting a vote is only possible in the List view of a SP List. You can use JSON to get to to display in Gallery or Board view, but you can't vote in either View.
2. I can't seem to connect the SP List rating to Power Apps. The latter doesn't seem to see it as a data source. Would really like to get provide Like voting in the Power App.
Anyone know?
- Rob_ElliottJan 30, 2024Silver Contributor
ScottAtWork it's very easy to create a ClickCount voting system for a list using some JSON column formatting. In the example below the user can vote for their favourite flag just by clicking the button in the Vote column.
In the list there is the title column for the name of the country, a single line of text column for the capital, a hyperlink column (displayed as an image) for the flag which has been uploaded to a document library, another hyperlink column for the vote button - the alternative text field is used for the button text, and finally a number column (no decimal places) named ClickCount for theā¦.click count!
The vote column is formatted in advanced mode with the following JSON. It uses the setValue action to increment the value of the click count by 1.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "style": { "display": "=if(@currentField == '' , 'none' , '')" }, "children": [ { "elmType": "div", "customRowAction": { "action": "setValue", "actionInput": { "ClickCount": "= [$ClickCount] + 1" } }, "children": [ { "elmType": "a", "style": { "text-decoration": "none", "padding": "5px 10px 5px 10px", "font-weight": "bold", "border-radius": "5px", "font-size": "13px", "white-space": "nowrap" }, "txtContent": "@currentField.desc", "attributes": { "href": "@currentField", "target": "_blank", "class": "ms-fontColor-themePrimary ms-bgColor-themeLighter ms-fontColor-white--hover ms-bgColor-themePrimary--hover" } } ] } ] }The ClickCount column is formatted with the following JSON to make the font bold and larger and change the color to green if the flag has a vote:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "debugMode": true, "txtContent": "@currentField", "style": { "color": "=if(@currentField > 0, '#32CD32', '#ff0000')", "font-weight": "=if(@currentField > 0, 'bold', 'normal')", "font-size": "18pt" } }This is the result. When the user clicks the button a larger version of the flag opens and the vote increments by 1.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)
- markikav1955Apr 07, 2022Brass Contributor
EngineerTony How do you switch on the Rating setting for Lists if it isn't there? I can't find it anywhere even in Site settings?
- markikav1955Apr 07, 2022Brass ContributorActually its ok, must be the config of this particular site because another site has it!!
- ComputerChicApr 13, 2022Copper Contributor
I was able to do the voting/rating/liking with a personal list, but not a site list. Anyone else seeing that? If you have it on a site list, how did you get it updated?
thank you!Lori
- AndreasHvidNov 01, 2021Copper Contributor
This was pretty much what I was looking for, thank you!