Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using JSON to edit field Sprint when using Automation to create tickets for parallel active sprints

mauricio.neves
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 6, 2022

Hello Community,

I created an automation rule triggered by the event "When Sprint is started", to create some mandatory tasks that should go in that sprint.

I managed to create the ticket and label the Summary field with the Sprint name using the field value, for example: {{sprint.name}} Sprint Meetings / Standup - Log time. Also, the second field that I need to be populated is Sprint, using the same name, and it works, as I set the field to use the value of the Active Sprint.
(See Image 1 below).

Image 1.JPG

When I start the sprint and the automation runs, the tickets are created with the summary fetching the value of sprint name and everything works fine. The ticket 

The problem starts when I start a parallel sprint on the same project (with a different name, of course). The Automation creates the tasks as it should be (great!), the summary takes the name of this second sprint (great!), however, the tickets are placed in the previously started sprint, and not in the second sprint that I started. 
(See Image 2 below). 

Image 2.JPG

I believe that instead of choosing to change the field "Sprint" copying the value of the Active Sprint, I should use some JSON code on the "more options" section, so the tickets created by automation for the SECOND sprint have, in the field "Sprint", the value (name) of the second sprint, therefore being placed in the right sprint.

I have tried something like:

 

{
"fields": {
"sprint": { "id": "{{sprint.name}}" }
}
}

But then Automation fails and I get the error: 

Error creating issue
Number value expected as the Sprint id., The Sprint (id) must be a number (customfield_10007)

 

So the question is: How do I make automation "understand" that either there are 2 parallel sprints and I should map tickets from Sprint A to Sprint A, and tickets from Sprint B to Sprint B - OR - how can I write the JSON code in order to create the ticket and set the value of field Sprint to the same value as {{sprint.name}} ?

 

Thank you in advance for the support and help!
Best,
Mauricio

PS: I have read many many articles already, including the ones below, that look very similar to the problem that I am having, but they did not quite help with what I need.


https://community.atlassian.com/t5/Jira-Service-Management/Can-we-add-a-specific-Sprint-to-Automation/qaq-p/1867159
https://community.atlassian.com/t5/Jira-Software-questions/Automation-setting-incorrect-sprint-with-parallel-sprints/qaq-p/1491305
https://community.atlassian.com/t5/Jira-questions/JIRA-Automation-Set-Active-Sprint/qaq-p/1373729

 

1 answer

1 vote
Pramodh M
Community Champion
February 6, 2022

Hi @mauricio.neves 

Welcome to the Community!!

You are using the advanced field correctly just don't give the sprint name, give the id because it takes a number as the input

{
"fields": {
"sprint": { "id": {{sprint.id}} }
}
}

This should work, let me know

You should get the sprint id before you save the automation

Let me know if you have any queries

Thanks,
Pramodh

Pramodh M
Community Champion
February 7, 2022

Hi @mauricio.neves 

Were you able to resolve the error?

mauricio.neves
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 8, 2022

Hey Pramod, thank you for the quick answer!
I will test it soon - but does this mean that every new sprint, I will have to fetch the sprint ID first and edit the automation rule?

Chris Lee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2024

@Pramodh M  I've tried everything to get this to work.

{
"fields": {
"sprint": { "id": "{{508}}" }
}
}

 

Not valid json. But json validator says it's fine 

{
"fields": {
"sprint": { "id": 508 }
}
}

Says I need to provide an ID like original poster.

Can you post an example of WORKING Json to set a sprint?

Chris Lee
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 4, 2024

Above shit is wrong. Do this -> 

 

{
"fields": {
"sprint": 275
}
}

Where the # is the sprint ID as fetched above from the URL. Don't bother with the "ID" bullshit. It's wrong.

Like Elizabeth Ramsey likes this
Elizabeth Ramsey July 31, 2024

Chris's suggestion above worked great for me.  I used it in a different scenario, to revert an issue's sprint back, if a user tries to change it:

{
"fields": {
"sprint": {{#changelog.sprint}}{{from}}{{/}}
}
}

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events