Can we restrict from creating subtask until we reach certain step in the parent task workflow

Jayashree Shetty
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.
November 15, 2012

Consider in the parent task workflow. If we reach a step called "accepted" only then we should be allowed to create subtasks which in turn uses its own workflow , if that step in parent workflow is not reached then it should deny this. Can we handle this using the structure plugin or by configuring workflow?

IssueTypes can be linked to any workflow. An issue type for parent task can use the parent workflow and the subissue type can use the subtask workflow. Can we actually sync this up?

7 answers

2 votes
SABVARX March 2, 2015

As the permission is still not working you could use the "Parent Status Validator" from JIRA Misc Workflow Extensions Plugin and add this Validator to the "Create" Transition of you Subtask Workflow. This solved the problem for me to restrict creation of subtaks to the Parent Status "in Progress".

 

2 votes
Nitram
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.
November 15, 2012

Hi,

We can restrict the creation of sub task untill we reach a specific step.This can be done. You need to create a plugin and you need to add some java script code. With the above you can restrict the sub task.I will post the code below.This is just a example, you can add your logic.

jQuery(document).ready(function($) {
	JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
		stopFunction();
	});
	stopFunction();
	function stopFunction(){
		
		if( AJS.$('#status-val').text() != 'In Progress' ){
			AJS.$('#create-subtask').hide();
		}else{
			AJS.$('#create-subtask').show();
		}
		
	}
});

your atlassian-plugin.xml will look like this

<web-resource key="stopsubtask-js" name="createSubtask">
		<description>show or hide create sub task menu
		</description>
		<resource name="stopsubtask.js" type="download"
			location="templates/js/stopsubtask.js" />
		<context>atl.general</context>
	</web-resource>

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 15, 2012

This sounds very confused to me.

Your second paragraphs doesn't make a lot of sense to me - within a project, you can define any workflow for any issue type, but it's a fixed, one-to-one relationship. For example, Type A uses workflow 1, Type B uses workflow 2 and all the other types use workflow 3. It doesn't matter if the issue types are parent issues or sub-tasks. I don't grasp what you mean by "sync up" - you set the workflows up per issue type. If you want to use wf1 for all types, that's what you put in the workflow scheme.

The first paragraph is a bit more simple. In Jira, you cannot do this. Anyone with "create issue" can create an issue or sub-task in the project. The only thing that blocks sub-task creation is the "issue cannot be edited" flag, which is attached to a status in the workflow, and prevents a load of other actions as well (including edit).

I don't *think* the structure plugin adds a function for this either, but I'm not sure, I've not used it recently enough.

Jayashree Shetty
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.
January 29, 2013

Is there any validator for the transition that can be set to restrict user from creating the subtask until we reach a certain step in the parent task.

Renjith Pillai
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.
January 29, 2013

Validator kicks in only after a transition is attempted. Create sub-task is not related to that. Did you try setting the workflow properties as I suggested below?

0 votes
DannyL December 10, 2013

I tried jira.permission.subtasks.create=denied at the workflow status where I want to prevent the creation. It did not work. I also tried jira.permission.work=denied. It did not work either. Other than adding the property to the workflow step, is there any other thing I need to do?

Adolfo Casari
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.
December 10, 2013

See this.

As for creatings subtasks, it seems that won't work, since it can't be controled by workflow properties.

0 votes
Anton Romm July 22, 2013

Hi,

Unfortunately jira.permission.subtasks.create=denied doesn't work.

0 votes
Renjith Pillai
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.
January 29, 2013

May be you use the workflow permission properties which prevents people from creating sub-tasks.

https://confluence.atlassian.com/display/JIRA/Workflow+Properties

Use the permission jira.permission.subtasks.create=denied till you reach your status in which you want to allow everyone to create sub-tasks.

I am referring to the Jobin's docs at http://www.j-tricks.com/1/post/2011/02/permissions-based-on-workflow-status.html</span<>>

Adolfo Casari
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.
May 16, 2013

Hi, I tried permission jira.permission.subtasks.create=denied but it doesn't work.

However
permission jira.permission.work=denied , works OK.

0 votes
Jayashree Shetty
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.
December 9, 2012

Do we actually have to write javascript for this ? Or can we configure this using JIRA

Suggest an answer

Log in or Sign up to answer