Hi,
I'm looking to use the Create Issue post function to create an issue and all its subtasks in another project. I assumed this should split between two post functions but i'm struggling to iterate through the current issue's subtasks to get all their data and create them in the other project.
first of all, the two Create Issue(s) post-function must be in a Sequence of Post functions post function, unless you're using them in an Action (Shared, Scheduled or Event-based) to ensure the post-functions run one after the other (Jira doesn't guarantee that third-party post functions on issue transitions run sequentially).
Then, in the second post-function that clones the sub-tasks :
Worked! I replaced the ContextIssue for Parent with a SearchIssues as the ContextIssue didn't work. One more thing, is it possible to auto link the generated subtasks to the original subtask? So if the Parent ticket is 'blocked by' or 'addressed by', can the subtasks have that link to each other rather than the Parent? (this could be done through a Jira automation or a separate action but just wondering if possible through the CreateIssue action)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should be able to achieve this by adding the "Linked Issues" field to the "Set specific fields of new issue(s)" section, like this:
Note that you'll need to update the link type name (careful, it's the link type name as it appears on the "Issue Linking" Jira admin page, not the link type direction). You might also need to replace "outwardIssue" with "inwardIssue" depending on the direction of the link to create between the two subtasks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Last question, when iterating through the subtasks to create, can I filter out subtasks in a statusCategory of done? I've tried using filter but to no avail yet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ahmad Sidawi ,
you can use this as the iterator:
{{ issue | subtasks("*all") | filter(["fields.status.statusCategory.name","Done"], true) | dump(2) }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If i wanted to use Status instead and filter out several states would it be this?
{{ issue | subtasks("*all") | filter(["fields.status.name",("To Do", "In Progress")], true) | dump(2) }}
It worked for single states but multiple didn't. Was looking for an example here:
https://innovalog.atlassian.net/wiki/spaces/JMWEC/pages/138405679/Custom+Nunjucks+filters#filter
but they reference a single value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, you cannot filter out multiple values in one call to the "filter" filter. You need to use multiple calls to eliminate each status one after the other:
{{ issue | subtasks("*all") | filter(["fields.status.name","To Do"], true) | filter(["fields.status.name","In Progress")], true) | dump(2) }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Let's start by setting our Iterator, then add the fields we want to grab. To begin, set this as your iterator, and test it against an issue that has Subtasks:
{{issue.fields.subtasks | dump(2) }}
You should see a JSON output of all of the subtasks of the issue you test against. Make sure you check the "Iterator returns JSON" box. Now we can set Summary to:
{{ it.fields.summary }}
and Priority to:
{{ it.fields.priority.name }}
Unfortunately, this object only returns a subset of available fields for an issue, so it own't work for every field you may want to copy. You may be able to use the "subtasks" filter to build an array of each of the fields you want, but I'm not sure.
Cheers,
Evn
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.