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).
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,
Hello @Alicia Simon
You can use a smart value to set the Parent of the subtasks. Example:
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.
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:
Here is what I have in the rule (if there's a better way to show, let me know).
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After creating the parent task can you add a Log action to print the issue key to the Audit Log?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Were you able to complete your automation rule successfully?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
With each run it gets ticked about identifying the parent issue for each sub-task.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The rule creates the parent issue properly, but breaks down when I want to create a sub-task:
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)"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't use the Create Issue action to create your subtasks.
Instead use the Create sub-tasks action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's what I tried to do first. When I attempt to publish the rule after making this change, Jira Cloud complains:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please show the details of the rule with the Create Subtasks action, and the details of that action.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.