I am trying to clone a defect issue type creating a bug issue type using a manual trigger and while cloning initialize some bug fields. The bug depending on the input value from the manual trigger can be created in the same project or in a different one I also added a link to the defect issue type. Everything works fine, but now I want to add subtasks. I need to do it within the same rules because the bug can be created in a different project, so I want to do it as part of the Clone issue action.
Here is for example the JSON file for the case the bug is created within the same project:
{
"fields": {
"customfield_10100" : { "id": "{{severity.get(issue.customfield_10262.id)}}"},
"customfield_10101" : { "id": "{{type.get(issue.customfield_10264.id)}}"},
"customfield_10103" : { "id": "{{environment.get(issue.customfield_10266.id)}}"},
"customfield_10162" : "{{product}}"
},
"issueUpdates": [
{
"fields": {
"issuetype": {"id": "10003"},
"project": {"key": "IFR"},
"summary": "Research Issue"
}
},
{
"fields": {
"issuetype": {"id": "10003"},
"project": {"key": "IFR"},
"summary": "Implement Fix"
}
},
{
"fields": {
"issuetype": {"id": "10003"},
"project": {"key": "IFR"},
"summary": "Validate Fix"
}
}
]
}
When I run the rule I don't get any error, the bug is created, with the corresponding values and linked to the defect, but the subtasks are not created. For creating the subtasks I took the idea from the Bulk create issue,
So the portion of the JSON file that is not working is the action: issueUpdates. Instead of using the project id, I am using the project key, but the rest is the same, removing the fields I don't need to set.
The issue type id is 10003, I got by putting in the browser the following (adding previously a sample temporary subtask to have a subtask section):
https://MYSITE/rest/api/latest/issue/IFR-532
and looking to the following portion within the subtask node of the JSON response:
"issuetype": {
"self": "https://pan-american.atlassian.net/rest/api/2/issuetype/10003",
"id": "10003",
"description": "A small piece of work that's part of a larger task.",
"iconUrl": "https://pan-american.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10316?size=medium",
"name": "Sub-task",
"subtask": true,
"avatarId": 10316,
"hierarchyLevel": -1
}
here is the Audit log of the execution:
and here is the content of the rule:
Here is the portion of the rule for the case of generating the bug within the same project:
Here is the bug generated:
Any help is appreciated. Thanks in advance.
I don't believe you can create subtasks via JSON. You probably will need a second rule to create the subtasks. Here is a good solution describing this:
@Darryl Lee this is what I did, as a workaround, but according to the REST API specification we can use the section issueUpdates to be able to do a bulk update for issues, I am surprised that the rule doesn't generate an error, so the syntax seems to be correct, but the subtasks were not created. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OH! I found the issueUpdates you were talking about. It's part of:
That's cool!
Unfortunately that is a different API call than what I think Automation gives us access to, which is the only as part of an issue Update/Edit. So only these options would apply:
I will say that in the past I've found out the hard way that sometimes the absence of an error does not necessarily mean it's correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.