Assignee sub-task

I have a issue that requires 4 approvals, so I created 4 sub-tasks with the Script Runner and set the custom field 'Role' to the group that can approve.

But I need to ensure that the user that approves one sub-task do not approve the others.

How can I do this?

3 answers

Add condition in the workflow which will allow only users in group specified by "Group Custom Field" to execute the Approve transition.

User Is In Group Custom Field- Condition to allow only users in a custom field-specified group to execute a transition.

Assuming your 'Role' custom field is of type "Group custom field".

My problem is that the group have 4 users and I created 4 sub-task (this number is fix), so I need that if the first user approve the first sub-task then he can't approve the others three.

Then you can add a User Picker custom field to the parent issue which is set by post-function when the first sub-task is approved and then a script condition which checks this field and allows only this user to execute the transition.

I would keep it simpler than creating 4 sub-tasks and keep the one issue.

Use one "Approval" state and 4 loopback transitions for the approvals. e.g. Approval 1, Approval 2, Approval 3 (or name them by the function of the approver) where each transition starts in "Approval" & ends back in "Approval"

You could also have 4 User picker custom fields to record who did each approval.

Only when all 4 approvals are in place do you open up the exit transition to finalise the approval.

You could use the Misc workflow extenstions plugin to enact a "Separation of Duties" so that users could only do one of the transitions.....

https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions

I'm trying to use this script in workflow condition of my subtask.

def parentIssue = issue.getParentObject()
def subTasksIssue = parentIssue.getSubTaskObjects()
for (int i = 0; i < subTasksIssue.size(); i++) {
	if (subTasksIssue[i].getAssignee() == currentUser) {
		return false;
	}
}
return true;

I put this code at the Builtin Script it works, but when I put in my workflow condition it always return true and I don't know why.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

691 views 6 13
Read article

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