Condition to block/allow subtask transition based on parent issue type and user role?

Michael Arndt
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.
July 1, 2019

Is there a way to block a subtask transition based on both the parent issue type and the user role?

For example

If issue type is a subtask and parent issue type is STORY then disallow transition of subtasks from In Progress to DONE unless user has Project Role XYZ

If issue type is a subtask and parent issue type is TASK then allow transition of subtasks from In Progress to DONE if user has Project Role ABC

Edit: Had to fix my example. 

2 answers

1 vote
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 1, 2019

You need to install JMWE to Jira Cloud in order to accomplish this. It cannot be done through the standard functionality.

You'll want to use the new condition "Linked Issues Condition (JMWE app)". You'll configure it like this:

Screen Shot 2019-07-02 at 6.07.00 AM.png

You would then need to add a nested condition to ensure the user is in the correct user role.

You'd then build the second set of conditions for the task/other project role. In the end, it would look something like this:

Screen Shot 2019-07-02 at 8.41.56 AM.png

You would click on the fork to build the nested conditions.

What this screenshot shows is that you need to meet 1 of the two conditions, but for each condition you need to meet all the nested conditions. So, a parent ticket of type "Story" you must be a developer to transition. OR your parent could be a task in which case you need to part of the service desk team.

 

Hope this helps!

Kian

 

EDIT: Updated Screenshots to reflect correct condition configuration.

0 votes
Michael Arndt
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.
July 1, 2019

In my case I want to set conditions on the subtask so wouldn't it be

Issue Link Type is a subtask of 

Issue Type Story
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 1, 2019

No, because the link is checking based on the relationship to the current ticket. This would be a set of conditions on the subtask workflow.

Essentially, you are saying "If my parent is a story, you must be in project role X to transition me".

Does that make sense?

Michael Arndt
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.
July 1, 2019

I think my example in my original post may have been wrong. Here's what I meant to say

If issue type is a subtask and parent issue type is STORY then disallow transition of subtasks from In Progress to DONE unless user has Project Role XYZ

If issue type is a subtask and parent issue type is TASK then allow transition of subtasks from In Progress to DONE if user has Project Role ABC


Does that change this?

Oliver Siebenmarck _Polymetis Apps_
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.
July 1, 2019

Hi Michael,

While Kian's approach with JMWE should work, it'd like to show off an alternative app, called Cloud Workflows, that you could use. It allows you to add conditions and validators based on Jira Expressions.

In case there are more issue types than just the sub-task in your workflow, you'll want to test for that first, which looks like this:

issue.issueType.name == "Sub-task" 

Additionally, you want to ensure that the parent of the issue has a specific type, which can simply be added with the following: 

issue.issueType.name == "Sub-task" 
&& issue.parent.issueType.name == "Story"

So, you would create a Cloud Workflows custom condition with the above Jira Expression and combine that with a condition that checks a user's project role and you're done.

Hope that helps!

Full disclosure: I work for the Vendor who created Cloud Workflows. Let me know if you need any help getting started.

Like Jan Szczepanski likes this
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 2, 2019

Michael,

I think I see the confusion. I made a mistake in the conditions I showed you earlier. They should look like this: Screen Shot 2019-07-02 at 6.07.00 AM.png

In addition, if you have other issue types that don't follow this behavior IE, subtasks of bugs should transition without limitation, you would need to add an additional condition onto the bottom.

Screen Shot 2019-07-02 at 8.41.56 AM.png

Michael Arndt
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.
July 3, 2019

Hmmm, I'm still having issues.

To clarify the questions. Only users with project Role "QA" can move a subtask linked to a Story to the workflow staged QA.

I've doublechecked a few things to make sure it wasn't human error. 

1. I made sure the changed workflow was published.

2. I made sure I removed myself from the project rule QA.

3. I was still able to move a subtask linked to a Story to the QA. 

I also made a dummy user account and tested in case me having site and jira admin was allowing me to bypass. Also, when I drag and drop the subtask to QA the column displays a "loading" very briefly so I know I'm targeting the right stage.

Here's the settings. Is there anything you can see that I did wrong?

AwesomeScreenshot-Transition-Review-Jira-2019-07-03-20-07-59.png

Michael Arndt
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.
July 3, 2019

Do I have to do anything else like assign this app to this project?

Oliver Siebenmarck _Polymetis Apps_
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.
July 4, 2019

Hi Michael,

You usually do not have to assign an app to a project, certainly not with apps that add workflow features.

I suggest you try enabling all conditions one-by-one, so that you know which one does not work as expected. My hunch would be that the last one for some reason evaluates to true, thus allowing your issue to be transitioned to QA. 

I'm not really sure how JMWE's injection of the linkedIssue works, but the more standard way to check a parent's issue type with a Jira Expression would be the one mentioned above. I'm pretty sure JMWE should allow that, too.

Hope that helps,

 Oliver

Like # people like this
Michael Arndt
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.
July 4, 2019

@Oliver Siebenmarck _Polymetis Apps_ Thank you. I installed Cloud Workflows and it seems to have gotten me almost to where I need to be. 

I was successful in controlling the sub-tasks using this method. I have two groups of conditions based on whether the parent issue is Story or Task.

issue.issueType.name == "Sub-task"  && issue.parent.issueType.name == "Story"
Where project role = "QA"

and also

issue.issueType.name == "Sub-task"  && issue.parent.issueType.name == "Task"
Where project role = "Project Member"

Those two have successfully allowed me to control Sub-tasks based on the parent issue type. 

Now I need to know how to apply the same condition to just the parent issue.

I tried this...

issue.issueType.name == "Task" 
Where project role = "Project member"

But the QA status is still blocked.  This seems to happen to Task types whether they have Sub-tasks or not.

I'm guessing the Jira expression I used is wrong.

Any suggestions?

Like Jan Szczepanski likes this
Michael Arndt
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.
July 4, 2019

I may have figured this out. 

issue.issueType.name != "Story" 
Where project role = "Project  member"

Testing it now.

Michael Arndt
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.
July 4, 2019

@Oliver Siebenmarck _Polymetis Apps_ 

I may have figured this out. 

issue.issueType.name != "Story" 
Where project role = "Project  member"

Testing it now.

Oliver Siebenmarck _Polymetis Apps_
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.
July 4, 2019

Sounds good, did you get it to work the way you want it to?

Michael Arndt
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.
July 4, 2019

I think so. I believe I understand the nuances enough now that I should be able to solve any future issues myself. Thanks for your help. I'll leave you a review.

Michael Arndt
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.
July 12, 2019

@Oliver Siebenmarck _Polymetis Apps_ 

Can I use an OR function in an expression. Something like this

issue.issueType.name == "Story" or "Epic"

 

Oliver Siebenmarck _Polymetis Apps_
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.
July 12, 2019

@Michael Arndt You totally can! The OR operator is || and it would look like this:

issue.issueType.name == "Story" || issue.issueType.name == "Epic"
Like Michael Arndt likes this

Suggest an answer

Log in or Sign up to answer