How do I check if an issue has been added to a Sprint with 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 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 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 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}}
Matthew Vanderzee November 4, 2016

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

Matthew Vanderzee November 4, 2016

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
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.
November 4, 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.

DORIAN KERSCH June 24, 2019

I know this is a very old thread, but I wanted to know if anyone figured it out?

 

I would like to access the "end date" in that custom field within Automation for JIRA. 

Gil
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 30, 2019

@andreas this doesn't seem to work. When We use Advanced Compare Condition, the rule doesn't work.

This is the first value: {{issue.fields.customfield_10702}}

Condition: contans regular expression

Regular expression: (state=FUTURE)

 

This value: {{issue.fields.customfield_10702}} returns the name of the sprint, but not the state of it and not the string that was posted by @Matthew Vanderzee 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events