Can I create sub-tasks with required fields using Automation for JIRA?

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2016

I want to create sub-tasks but have some required fields. When I used the current 'Create sub-task' action I get errors in the audit log.

1 answer

1 accepted

0 votes
Answer accepted
andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2016

You can also use the 'Create issue' action to create sub-tasks. It's not as straight forward, but allows you to specify additional fields.

For example you can configure a rule like this:

Project automation - JIRA 2016-09-07 09-12-39.png

 

So we're using the create issue action, specifying a sub-task issue type, summary and then use the 'Advanced' section to set the parent (and add a label in this case, but you can set any field value really):

{
    "fields": {
        "parent": { "key":"{{issue.key}}" }
    },
    "update": {
        "labels": [{"add": "sample-label"}]
    }
}

 

If you need to create multiple sub-tasks, then you'd have to add multiple 'Create Issue' actions to your rule.

Phyllis Zhu September 13, 2016

What would I write in the Advanced section if I wanted to create links? 

For example: 

When issue X has a certain update, create issue Y and link them. 

Issue X relates to Issue Y.

thanks!

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2016

Hi Phyllis,

Yes you can do this with the advanced section.  I've raised a new question to answer this:

https://answers.atlassian.com/questions/41478447

Cheers,

  Andreas

Vlad Gomzyakov September 20, 2016

The problem with that solution is that it only allows you to create issues under specific projects. While in creating sub-tasks you are creating them under the issue you create in whatever project you need. I am still looking for a solution of creating an epic in any project that would also create many sub-tasks under it. It doesn't create them because all our tickets have a required due date field. If only there was a way to set default values for those fields when creating the sub-tasks...

andreas
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 20, 2016

Hi @Vlad Gomzyakov,

So if you're using the "Create issue" action in Automation for JIRA, then you can certainly set the due date to a default value on create.  Extending the example from above, you can add this to your Advanced section:

{
    "fields": {
        "parent": { "key":"{{issue.key}}" },
		"duedate": "{{#now}}func=plusWeeks(1),format=\"jiraDateTime\"{{/now}}"
    },
    "update": {
        "labels": [{"add": "sample-label"}]
    }
}

The important bit is: 

{{#now}}func=plusWeeks(1),format=\"jiraDateTime\"{{/now}}

It will set the due date to one week from now. For more info on dates in smart-values see working with dates. It's not the prettiest syntax right now, and we'll most likely improve this in future.

Let me know in case this doesn't work for you!

Cheers,
 Andreas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events