Assignee sub-task

Ana Vier April 13, 2014

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

0 votes
Ana Vier May 13, 2014

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.

0 votes
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2014

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

0 votes
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2014

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".

Ana Vier April 14, 2014

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.

Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2014

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.

Suggest an answer

Log in or Sign up to answer