cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Malli88
Regular Visitor

Up/Down-Voting System for Sharepoint List

Hi @ ALL

I try to build my first Workflow.

Have a list in Sharepoint where I can see some Bug's out of Jira.

Not I need for any row a +1 / -1 button to up/downvote the bug.

How do I do that?

And my second question. Does anyone know good tutorials for flow/automate and the sharepoint/dynamics integration?

 

Thanks and best regards,

Stephan

1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @Malli88,

 

Yes, I can give you a bit more details.

 

1. Create the two columns. Votes (Number), UpVote (Single line of text). Make sure you set the default value of the Votes column to 0

votingcolumns.png
2. Create a flow with the following SharePoint trigger and actions. As a concept I used the For a selected item trigger, Get Item and Update item actions. You can use the Votes field to add the expression.

add(outputs('Get_item')?['body/Votes'],1)

 

threeactionsv2.png
3. Save the flow and make a note of the flow ID

flowid.png
4. Go the the list and format the UpVote column

formatthiscolumn.png
5. Add json to it, you can use my json as an example. Modify the id in the actionParams to use your flow id. Save the formatting.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"ac299030-fc6c-431a-b833-f567e6cbc1df\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "CaretSolidUp"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": ""
    }
  ]
}


6. Test the flow by creating an idea and by clicking the button in the UpVote column

View solution in original post

18 REPLIES 18
Expiscornovus
Super User
Super User

Hi @Malli88,

 

You could create a votes column (number data type) in that list and a column for a upvote button. Use column formatting to create the vote button which can trigger/execute the voting flow.

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#create-a...

 

uservoice_sharepointlist.png

 

 

Use the add() function to calculate the number of votes in the vote column in your flow and update the item again with the new value. You can sort the bug list on the votes column descending so the bugs with the most votes are shown first.

 

addfunction.png

Hi @Expiscornovus ,

 

thank you for the reply. Unfortunately I have no idea how to implement this.

What I have done so fare:

1. Column with a Butten that triggers a workflow

2. Column with number values

Malli88_0-1605266650171.png

What I have to do in the flow to get that running. Where I have to add the expression from your screenshot?

 

Thank you and best regards,

Stephan

 

 

Expiscornovus
Super User
Super User

Hi @Malli88,

 

Yes, I can give you a bit more details.

 

1. Create the two columns. Votes (Number), UpVote (Single line of text). Make sure you set the default value of the Votes column to 0

votingcolumns.png
2. Create a flow with the following SharePoint trigger and actions. As a concept I used the For a selected item trigger, Get Item and Update item actions. You can use the Votes field to add the expression.

add(outputs('Get_item')?['body/Votes'],1)

 

threeactionsv2.png
3. Save the flow and make a note of the flow ID

flowid.png
4. Go the the list and format the UpVote column

formatthiscolumn.png
5. Add json to it, you can use my json as an example. Modify the id in the actionParams to use your flow id. Save the formatting.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"ac299030-fc6c-431a-b833-f567e6cbc1df\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "CaretSolidUp"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": ""
    }
  ]
}


6. Test the flow by creating an idea and by clicking the button in the UpVote column

View solution in original post

Hi @Expiscornovus 

thank you very much for the reply.

I get an error on the function element.

Perform a correction to include a valid reference to Get_item for the input parameters of the Update Element action.

Expiscornovus
Super User
Super User

Hi @Malli88 

 

Get_item is a reference to the second action of the flow. In this example I named my action Get Item. What is the name of the action in your flow?

 

If it is a different name you will need to adjust your expression to update it with your action name.

add(outputs('Your_second_action_name')?['body/Votes'],1)
Malli88
Regular Visitor

Hi @Expiscornovus 

get the message:

 

Flow execution error: At least one specified field has the type "null".

 

 

There is no required field with empty entry. And I prefilled the votes field with 1.

 

Malli88_0-1605512128699.png

 

 
Malli88
Regular Visitor

Have the solution!

Added a Compose to get the value of Votes field.

Expiscornovus
Super User
Super User

Hi @Malli88

 

Can you show the output of the element abrufen action in your screenshot?

Malli88_0-1605518974872.png

I get the Nullpointer every time the value of Votes is "Null" or "0".

It is just working for values >=1.

 

Mariah_cz
New Member

Works perfectly, this is brilliant! Rhanks to you I learn and develop:)

But what about voting on the list shown in a webpart on a page? This doesn't work in such conditions, I'm afraid 😞

Thank you for this solution. One question - when i click on the upvote button the workflow is executed but I get a pane on the right and i have to click the "Run Flow" button. Is there a way to not display the right pane and just execute the workflow without showing the right pane?

 

manavpurohit_0-1630131379652.png

 

Hi, I have followed every step, but when I press the UpVote button, nothing happens.
Would you be able to assist me here?

Below you can see my setup.

wahlbang_0-1633420010870.png

 

 

wahlbang_3-1633420147656.png

 

 

wahlbang_2-1633420116480.png

wahlbang_4-1633420184052.png

wahlbang_5-1633420222677.png

 

wahlbang_6-1633420299015.png

 

wahlbang_7-1633420347930.png

 

Expiscornovus
Super User
Super User

Hi @wahlbang,


Is your flow created in the default environment, or a different environment? 

 

And can you also check if the flow is listed in the automate section when you select an item. If that is the case can you try and run it from there. See if that makes any difference?

 

checkiflistedinautomatesection.png

Hi @Expiscornovus,

It's not in the default environment, it's located under the team in MS Teams.
The flow is not available in the automate section.

Should I try to create it in the default environment? Will others be able to vote then?

Br
Wahlbang

Expiscornovus
Super User
Super User

Hi @wahlbang,

 

Yes, can you try that.


There is a known limitation for this trigger action:

https://docs.microsoft.com/en-us/connectors/sharepointonline/#known-issues-and-limitations
For Flows that use the 'For a selected item' or the 'For a selected file' trigger, only those that are part of the Default environment in Power Automate are listed within the SharePoint Automate menu.

@Expiscornovus 
Perfect, it's working now! Thank you so much 🙂
Is there a way to not display the right pane and just execute the workflow without showing the right pane?

Expiscornovus
Super User
Super User

Hi @wahlbang,

 

With this setup I don't think it would be possible to hide the panel. The actionparams of the executeflow action are pretty limited. You can set the header text and the button text. But I don't see any parameter for hiding the panel though:

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#button-e...

Hi @Expiscornovus 

Alright, what I experienced now is that my colleagues are not able to press the button in Teams so we use the web version, and it takes very long time to get the prompt, sometimes it's not even shown 😞


Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,894)