Clear votes on an issue

I'm designing a workflow in which a user makes a request, and depending on the category of said request a group of users are notified of the request and prompted to vote for it (essentially approving the request) or execute a 'Deny Request' transition. The 'Approve Request' transition ONLY appears when the number of votes on the issue is equal to the number of users in the group whose approval is required.

If a user denies the request, the inital requester is prompted to fix the request and re-submit for approval. Below is a picture of my workflow. 

Untitled.png

The problem is that if someone votes for a request, their vote remains even if someone else denies the request and it's re-submitted with changes. 

I created a post function to execute on 'Re-submit request' transitions, intended to remove a vote from each user in the 'Needs approval from' group. Here's what I've got so far. 

import com.atlassian.jira.component.ComponentAccessor
def groupManager = ComponentAccessor.getGroupManager()
def voteManager = ComponentAccessor.getVoteManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName('Needs approval from')
def groupName = cf.getValue(issue)
int groupSize = groupManager.getUsersInGroupCount(groupName)
def groupUsers = groupManager.getUsersInGroup(groupName) 

int i
for (i = 0; i < groupSize; i++) {
    voteManager.removeVote(groupUsers[i], issue)
}

First of all, is this possible? An older, similar question on this forum received answers suggesting it was not possible without doing something in Confluence, but that was back in 2014. 

Thanks in advance for any help.

 

1 answer

1 votes
Brant Schroeder Community Champion Apr 26, 2017

Steve,

  I do not believe that it is possible at this time.  There is a JIRA feature request here: https://jira.atlassian.com/browse/JRASERVER-37616 that addresses it but has hardly any votes.  It has also been out there since 2014 so I doubt you will be able to do it anytime soon.  You could see if there is a custom field or plugin that would provide this functionality in the marketplace.

Hope this helps.
Brant

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,864 views 12 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot