Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,018
Community Members
 
Community Events
168
Community Groups

Jira Automation: How to specify parent issue key or id?

Hi guys, 

I set up an automation and the trigger is "Transfer to development upon completion? Yes/No". If select Yes, it will create a new issue in development related project when the issue is complete. 

And here is the problem I'm having, if I create a sub-issue and select "Yes" to trigger development issue creation, it fails and returns "Error creating issue: Issue type is a sub-task but parent issue key or id not specified. (issuetype)".

截圖 2022-08-23 下午5.29.31.png

Because sometimes the task is big and we need to create sub-tickets to solve it, can someone teach me how to solve this problem?

Thank you in advance!

4 answers

1 accepted

0 votes
Answer accepted
Mark Segall Community Leader Aug 23, 2022

Hi @James Chen - Can you please share a screen shot of your rule? 

Hi @Mark Segall , here is the rule.截圖 2022-08-24 下午12.19.07.png

When an issue is transitioned and matches the condition, then it will create a new issue in another project.

Mark Segall Community Leader Aug 24, 2022

Your rule seems simple enough.  In your rule details, have you verified that the scope is set for multiple projects or global?  You mention that you're trying to create an issue in another project.  This will fail if your rule scope is set to a single project.

Mark Segall Community Leader Aug 24, 2022

Sorry just re-read this.  You're trying to create a sub-task in another project.  The challenge is that you need to have a parent issue as an anchor and need some way to query for that parent issue so you can create the sub-task under it.  If you have business logic that you can use to identify the parent issue on the other project (e.g. link to the original task, label, anything else that can isolate it), you can use a Lookup Issues action to query for it and then use {{lookupIssues}} as the parent link for the sub-task you're trying to create.

Like Bill Sheboy likes this

Hey Mark, 

Actually I didn't want to create a sub-task in another project. What I want to do is when a subtask in project A is completed, it will automatically create a new task in project B. (not sub-task in B)

Mark Segall Community Leader Aug 25, 2022

Ok - It's making sense.  So, the problem with your rule is that under your create issue action, it is set to Same Issue Type.  The fact that this is triggered by a sub-task means that it will try to create a sub-task on your destination project which fails because it has no specified parent.  So, you need to change that field to the desired issue type.

Like # people like this

@Mark Segall @John Funk , 

I changed the issue type to "Task" in my rule and it works! The sub-task finally can create a new task in another project. Really appreciate your time and suggestions.

Update: use the advanced function to try this:

{
"fields": {
"parent": {
"key": "{{issue.parent.key}}"
}
}
}

But it showed another error message:

截圖 2022-08-25 下午6.08.33.png

0 votes
John Funk Community Leader Aug 24, 2022

Hi James,

I am wondering if you could use the advanced function to populate the parent key. Something like:

{
"fields": {
"{{issue.parent.key}}": {{triggerissue.parent.key}}
]
}
}

I have not tried this before - using a smart value for the field name. 

Thanks John, I tried your suggestion but it doesn't work :(

John Funk Community Leader Aug 25, 2022

So all of these sibling sub-tasks have the same parent I assume. Is it possible that it is returning more than one project? Is this rule for a single project? 

John Funk Community Leader Aug 25, 2022

Just saw the clarification below. So just change the Issue Type in being created to Story and get rid of this advanced code, and you should be good. 

Like James Chen likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events