Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Scriptrunner] finding the parent issue type

Hey all,

just wanted to ask a short question. I have a "Create Subtask" Action added to the transition. In the condition field I want to ask for the parent object issue type because I want the action to be executed exclusively for a specific issue type.

Thank you in advance and kind regards

Gerhard

3 answers

2 accepted

4 votes
Answer accepted
Nir Haimov Community Leader Jul 04, 2019

This will give you the value of parent issue type:

issue.getParentObject().getIssueTypeObject().getName()
0 votes
Answer accepted
Antoine Berry Community Leader Jul 04, 2019

Hi @Gerhard Degel ,

If you expand the examples you should have what you are asking for (and maybe some other useful ones for later) : 

image.pngAntoine

@Antoine Berry just to confirm, the issuetype here is of the subtask correct? not the parent?

I'm trying to transition the parent only if the parent is a issuetype of 'Test'. I'm using the following, but it isn't working.

issue.parentObject.getIssueTypeObject().name == 'Test'

When I put logging in, it appears that I have it correct. 

2021-07-01 18:40:53,893 DEBUG [runner.ScriptBindingsManager]: issuetype of parent is Test 2021-07-01 18:40:53,894 DEBUG [runner.ScriptBindingsManager]: status of parent is Retest

But it isn't changing the parent status. I'm not sure how to debug that because it is a delivered post function.

I'm not a developer and would love your thoughts.

Thanks!
Laurie

Antoine Berry Community Leader Jul 02, 2021

Hi @LaurieC ,

the test condition

issue.parentObject.getIssueTypeObject().name == 'Test'

indeed tests against the parent issue type, so the condition will be true if the name of the parent subtask is "Test".

But what you are trying to achieve is a bit confusing so if you could add some insights that would help.

Thanks so much for responding @Antoine Berry

I have an issuetype called "Test". I have a subtask called "Test Step" that allows me to build out the steps in a test scenario. When all of the Test Steps are passed, the parent Test issue type will be automatically passed using the "Transition parent when all subtasks are resolved" built in script. I don't need a condition on that one.

If, during the testing process, someone finds a problem and an action needs to be taken before all Test Steps can be completed, they can track that action using a generic subtask. If all of the generic subtasks are resolved and all of the Test Steps are resolved, I want the parent Test issue type to move to pass as well. But I don't want that same functionality for other parent issue types - therefore, I want a condition on the post function that will only run if the parent is a "Test" issue type. Does that make sense?

I tried putting the above condition in, but it doesn't seem to be working.

Any thoughts? Or am I think about this incorrectly?

Thanks again for your time!

Antoine Berry Community Leader Jul 19, 2021

Hi @LaurieC ,

First, I am very sorry for the late answer. I have tried your exact scenario and made it work. I suspect you have a recent version of Jira that makes one of the deprecated methods fail.

Could you please try instead : 

issue.parentObject.issueType.name == 'Test'

Make sure you add this postfunction on the resolve transition of the sub-task workflow, and that the correct parent transition is selected : 

image.png

 

Let me know how that went.

Antoine

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you