Issue with Sub-tasks automation need parent ID error

Alicia Simon May 10, 2023

I am trying to create an automation that creates a new issue within a project and within that new issue create two sub-tasks. The issue is created successfully, but I receive errors regarding the sub-task creations:  Issue type is a sub-task but parent issue key or id not specified. (issuetype).

JIRA-Ranches MonthlyFinancialsError.png

Yet in the automation rule I have the parent issue set as "Current Issue". How do I get the automation to create the sub-tasks within the issue that is created? 

 

Thank you, 

1 answer

1 vote
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2023

Hello @Alicia Simon 

You can use a smart value to set the Parent of the subtasks. Example:

Screen Shot 2023-05-10 at 2.40.39 PM.png

Because you are created multiple subtasks I would recommend you do this:

After the creation of the parent issue and before creating the first subtask:

1. Add a Re-Fetch Issue action to ensure the parent issue creation has completed.

2. Add a Create Variable action to store the key of the created parent. The value you want to store is {{createdIssue.key}}

Then, in the Create Issue actions where you are creating Subtasks, set the Parent Issue field to the smart value for the Variable you created.

Alicia Simon May 11, 2023

Hi @Trudy Claspill ,

I tried your suggestion and while it made sense, the result I got is confusing. 

Instead of creating one issue with two sub-tasks, the rule created two new issues, each with the first sub-task and also two new sub-tasks under unrelated existing issues (68 & 41).

I also receive an error regarding creating the second sub-task of the rule.

Results:

JIRA-AutoSubs8.pngJIRA-AutoSubs7.png

 

JIRA-AutoSubs1.png

Here is what I have in the rule (if there's a better way to show, let me know).

JIRA-AutoSubs2.png

JIRA-AutoSubs3.png

JIRA-AutoSubs4.pngJIRA-AutoSubs5.png

I'm beginning to think I just need to create individual issues and not worry about sub-tasks, but I was hoping to keep the board cleaner this way. 

 

I appreciate your help. 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

Hello @Alicia Simon 

The unexpected results have to do with your trigger.

In your Scheduled trigger you have included a JQL. When you include a JQL in your Scheduled trigger you are telling the Automation that those are the issues you want to operate against. The steps in the automation will be executed for each issue returned by that JQL.

Since your JQL found two matching issues, it will loop through all the actions in the rule twice; once for each issue found.

I don't think you want that. If you think you do then I have missed something in you explanation, and can you please explain how creating a new issue and subtasks relates to the issues you are selecting with JQL?

If indeed you don't want that, then remove the JQL from the trigger and try running the rule again.

Alicia Simon May 11, 2023

I have tried to create it without the run a JQL box checked but I always get an error. In this case here is the error I get.

 

JIRA-AutoSubs9.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

Hello Alicia,

It is the Re-fetch issue data action that is causing that error. Try removing that.

I thought it would be needed after a Create Issue action, but I guess it is not.

Alicia Simon May 11, 2023

I have progress! The only thing is the second sub-task has not been created and I get the following error. I do have the sub-task set to the correct project, Ranches. 

JIRA-AutoSubs10.png

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2023

After creating the parent task can you add a Log action to print the issue key to the Audit Log?

Screen Shot 2023-05-11 at 11.00.42 AM.png

Alicia Simon May 24, 2023

I added in the log action, but then get the "Project or issue type not set" even though the project IS set. 

I've given up. I don't' understand why it's not simple to just create a new task, create a new sub-task, then create a second sub-task. The amount of time wasted is pointless and I'm just using two automations to have separate task created. 

 

Thank you for your help. 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2023

I am sorry this has been difficult.

I found a simpler way to do this. There is an action that I had not noticed until recently - Create Subtask.

I tested this in both a Company Managed and a Team Managed project and it worked to create the issue and create multiple subtasks under the newly created issue.

Screen Shot 2023-05-24 at 2.45.39 PM.png

Like Alicia Simon likes this
Don Sizemore July 3, 2023

@Trudy ClaspillI'm breaking down on sub-task creation:

"Issue type is a sub-task but parent issue key or id not specified. (issuetype)"

I'm in the Cloud, so all I can do is select "Parent Issue" or "Trigger Issue" - no typey-type for me.

It doesn't seem to like my specifying {{createdIssue.key}} in the additional fields JSON, but perhaps I'm providing it in the wrong element.

Any pointers would be most appreciated.

Trudy Claspill
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 3, 2023

@Alicia Simon 

Were you able to complete your automation rule successfully?

Trudy Claspill
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 3, 2023

@Don Sizemore 

Welcome to the Atlassian community.

Please show us the complete automation rule you have created. Did you try to implement the simpler solution that I showed in my last reply? That doesn't require typing in any values.

Don Sizemore July 3, 2023

@Trudy ClaspillHello, I have two similar automation rules which each fail in the same way. I tried the simpler solution you suggested above first, but to be able to publish the rule I had to "add fields" which made it angry about the parent issue. My root problem is that, in Cloud Jira, I can only select drop-down entries for the parent issue during subtask creation.

Screenshot 2023-07-03 at 14.14.05.png

With each run it gets ticked about identifying the parent issue for each sub-task.

Trudy Claspill
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 3, 2023

@Don Sizemore 

Can you try the simpler method again and provide this additional information:

1. Are you using a JQL in your trigger?

2. Show the details of the steps for creating the new parent issue and the subtasks.

3. Show the error message you said you were getting about being required to "add fields". Do your subtasks have required fields besides the Summary field?

Don Sizemore July 3, 2023

@Trudy ClaspillI am not using a JQL trigger, and that was my initial problem. Without one, simple sub-task creation complains: "The rule has been configured with components that require issues to be provided by the trigger. You need to use the option to run JQL to provide issues. The following components require issues: Create sub-tasks"

but... the issue doesn't exist yet, because the automation rule fires on a schedule to create the issue? am I going about this all wrong?

Trudy Claspill
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 3, 2023

You do not need a JQL in the Schedule trigger to create new issue on a scheduled basis.

Please try creating a new rule with the simple method I outlined (shown below). Do not include a JQL in the trigger. Show us the details of each step in the rule.

If you get an error message trying to publish the rule, show us a screen image of that error message.

Screen Shot 2023-05-24 at 2.45.39 PM.png

 

If you are able to execute the rule and it doesn't do what you expect, show us the details in the Audit Log for the rule execution.

Don Sizemore July 3, 2023

Correct - I created a new rule, with sub-tasks as you display above. The error in publishing the rule is "The rule has been configured with components that require issues to be provided by the trigger. You need to use the option to run JQL to provide issues. The following components require issues: Create sub-tasks" (just with a red background)

Thank you,
Don

Trudy Claspill
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 3, 2023

Please provide a screen image of your rule and screen images showing the details of each step.

There is something in the details of the steps you created that is causing the error. I don't get that error when I create the same rule.

Don Sizemore July 6, 2023

The rule creates the parent issue properly, but breaks down when I want to create a sub-task:

Screenshot 2023-07-06 at 11.15.13.png

The problem, as I see it, as that in Jira Cloud I can't type {{createdIssue}} or anything else in the "Parent Issue" field. The error is "Issue type is a sub-task but parent issue key or id not specified. (issuetype)"

Trudy Claspill
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 6, 2023

@Don Sizemore 

Don't use the Create Issue action to create your subtasks.

Instead use the Create sub-tasks action.

Screen Shot 2023-07-06 at 10.05.12 AM.png

Don Sizemore July 6, 2023

That's what I tried to do first. When I attempt to publish the rule after making this change, Jira Cloud complains:

Screenshot 2023-07-06 at 15.20.54.png

Trudy Claspill
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 6, 2023

Please show the details of the rule with the Create Subtasks action, and the details of that action.

Alicia Simon July 20, 2023

@Trudy Claspill I just saw your reply and was able to successfully create the automation with the new branch component. I also couldn't use the "same project" or I'd get the "project or issue type not set". Not a problem since I could specify the project easily. 

The only thing different than how yours looks is when I added details/fields, it changes to two individual "Then: Create a new" instead of create sub-tasks. 

Screenshot 2023-07-20 095918.png

Like Bill McElroy likes this
Bill McElroy March 23, 2024

Awesome, this worked for me!

 

Like Trudy Claspill likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events