How do I check if an issue has been added to a Sprint with Automation for JIRA?

Andreas Knecht Community Champion Sep 20, 2016

I would like to perform some type of automation action everytime an issue is added to a sprint.  How can I do this with Automation for JIRA?

1 answer

1 accepted

0 vote
Andreas Knecht Community Champion Sep 20, 2016

You can create a rule using the comparator condition (see our full list of rule components) and smart-values:

Project automation - Code Barrel JIRA 2016-09-21 10-00-27.png

When an issue is added to a sprint, we can use the 'issue updated' trigger to detect this. Then we use the comparator condition to check that the "Sprint" field was changed to a value (i.e. "does not equal Empty").

To access the changelog value we changed to, we can use this smart-value completion:

{{#changelog.Sprint}}{{toString}}{{/changelog.Sprint}}

Thanks @Andreas Knecht -  Is there a way to further filter to only sprints that are active (i.e., have been Started)?

Update - the sprint field contains an object which contains the correct data:

{{issue.fields.customfield_10102}} (our 'Sprint' field)

yields 

[com.atlassian.greenhopper.service.sprint.Sprint@15cdc97[id=138,rapidViewId=163,state=FUTURE,name=SPRINTNAME,goal=,startDate=<null>,endDate=<null>,completeDate=<null>,sequence=138]]

Is there a way in the rule to reference into this object to get the state field?

Alternately we could just regex for 

state=ACTIVE
Andreas Knecht Community Champion Nov 04, 2016

Matthew - so yes you're absolutely right - when an issue is being added to a sprint, then the custom field will contain the string above, which you can match against with a regular expression.

Unfortunately there's no way to get JSON for this customfield in the webhook we receive from JIRA. I've raised a support request for this, which should hopefully result in a bug being raised on jira.atlassian.com.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you