set up automation creating new sprint

sim.sisavuthary January 31, 2022

Dear community,

I would like to set up automation to create newsprint as for now I am doing it manually.

the condition:

if I set every 2 weeks, the current sprint to be closed and a new sprint to be created. It will automatically create a new sprint every 2 weeks. 

please kindly guide how to do it?

3 answers

2 votes
Guy Anela November 8, 2022

Hi @sim.sisavuthary - You can create a sprint by using the Send web request Action. You'll want to POST to the REST API sprint end point and pass the new sprint info in the Custom data section (in JSON format)...

AtlassianCommunity-AutoCreateSprint.png

I created a Scheduled Automation that runs every week and if there aren't at least 2 Future Sprints, it will automatically create them using the above Action. Anyhow, I hope this helps. Cheers!

Darlene Jeter () November 10, 2022

Does this work in "Cloud"? And if so, for multiple projects or just 1?

Guy Anela November 10, 2022

Hi @Darlene Jeter ()  - Yes, we're on the Cloud and we currently have it executing against a few Projects. I basically created a separate Automation for each Project. I did it this way because each project had specific requirements that would have been difficult to capture in a single Automation (e.g. Different Sprint naming conventions, # of sprints wanted, etc.).

Darlene Jeter () November 10, 2022

@[deleted] Thank you ever so much. I will try and configure in DEV and let you know. Again, thanks!!!!

Like Guy Anela likes this
Raju Mandapaka December 15, 2022

Hi @Guy Anela 

I tried the same option what you have shown, but this rule is throwing some errors, could you please review and let me know what mistake i am doing.

Automation rule -1.JPGerror screen shot.JPG

 

Thanks in advance.

Raju

Guy Anela December 15, 2022

Hi @Raju Mandapaka - It looks like you're missing a comma after the {{NewSprintStartDate}} value...

CreateSprintPayload.png

Give this a try...

{
"originBoardId": 4837,
"goal": "",
"name": "{{NewSprintName}}",
"startDate": "{{NewSprintStartDate}}",
"endDate": "{{NewSprintEndDate}}"
}

 

I hope this help. Cheers!

Raju Mandapaka December 15, 2022

My bad, how i missed a simple thing - May be due to friday evening effect.

 

Thanks a lot for your help.

Pfohl Jason February 22, 2023

@Guy Anela I am running into issues with my web request URL and the headers. Could we set up some time to go over this outside of this chat thread? Thaks

Guy Anela February 22, 2023

Hi @Pfohl Jason - Can you post a screenshot of your web-request and any error messages you're getting?

Here's an example of what my first web request looks like...


AutomationExample-GetSprintWebRequest.png

Pfohl Jason February 23, 2023
Guy Anela February 23, 2023

Hi @Pfohl Jason - Your Web request URL is missing a slash between the version (1.0) and "board". It should look like this...

https://yourdomain.atlassain.net/rest/agile/1.0/board/1201/sprint?state=future

Pfohl Jason February 23, 2023

Thanks @Guy Anela made changes and now seeing this message.  I am assuming that my organization is preventing this to run since this is a target resource error?

Jira3.PNG

Guy Anela February 23, 2023

In your previous screenshots, I see that you created variables for the {{NewSprintStartDate}} and {{New SprintEndDate}} but I don't see variables for the {{BoardID}} and {{NewSprintName}} smart values you're including in your Custom data payload...

2023-02-23_8-09-20.png

 

I'm guessing it's failing because it doesn't know what target "Board" to add the sprint to. 

Just to make sure your Web request works, I would just hardcode the values in the payload...

{
"originBoardId": "1201",
"goal": "",
"name": "New Sprint Name",
"startDate": "2023-02-23",
"endDate": "2023-03-09"
}

 Once you have that working, you can create the Variables and add the {{smart values}} to the payload.

I hope this helps. Cheers!

Yatish Madhav
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.
May 8, 2023

Thanks for this post and the comments @Guy Anela 

Please can you be so kind as to advise where I am going wrong and getting 401 ... The rule actor is the account that I generated the API token ... The Authorization is Bearer <apitoken-redacted-here>

This is frying my brain!

Screenshot from 2023-05-08 15-47-45.pngScreenshot from 2023-05-08 15-46-01.png

Yatish Madhav
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.
May 9, 2023

Hi - I found my issue. I used Bearer APITOKEN instead of Bearer APITOKENENCODED. It now works ... 

However, I am having an issue where I am trying to do this 4 times - ie. created 4 sprints in 1 automation rule for 4 consecutive weeks. 2nd one fails with a 400

Any idea why? Help would be greatly appreciated.

Thank you

Guy Anela May 9, 2023

Hi @Yatish Madhav - Glad to see you were able to figure out the encoded token issue. :)

As far as the new 400 error, it's hard to know without seeing how your Automation is configured. How are you sending the subsequent requests? Also, have you tried logging the web response to the Log to see if it has any further clues? 

Yatish Madhav
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.
May 9, 2023

Thanks for the reply @Guy Anela 

The only difference in the consecutive web request actions is the payload/custom data as below with bolded parts changed. the headers, URL and methods are the same:

1.

{"name": "{{now.plusWeeks(4).withNextDayOfWeek("MON").format("d MMM")}} - {{now.plusWeeks(4).withNextDayOfWeek("FRI").format("d MMM uuuu")}} spr","startDate": "{{now.plusWeeks(4).withNextDayOfWeek("MON")}}","endDate": "{{now.plusWeeks(4).withNextDayOfWeek("FRI")}}","originBoardId":1,"goal": ""}

2.

{"name": "{{now.plusWeeks(5).withNextDayOfWeek("MON").format("d MMM")}} - {{now.plusWeeks(5).withNextDayOfWeek("FRI").format("d MMM uuuu")}} spr","startDate": "{{now.plusWeeks(5).withNextDayOfWeek("MON")}}","endDate": "{{now.plusWeeks(5).withNextDayOfWeek("FRI")}}","originBoardId":1,"goal": ""}

and so on ...

The audit log error I get is this:

<html> <head> <title>Bad Request (400)</title> <!--[if IE]><![endif]--> <script type="text/javascript" > var contextPath = ''; var DeferScripts = { deferState: 'disabled' }; </script> <script> window.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{}; WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path"]="\"\""; WRM._unparsedData["com.atlassian.plugins.atlassian-plugins-webresource-rest:curl.cross-origin-resources"]="false"; WRM._unparsedData["jira.webresources:feature-flags.feature-flag-data"]="{\"enabled-feature-keys\":[\"connect.no-applinks\",\"com.atlassian.jira.agile.darkfeature.burnupchart\",\"nps.survey.inline.dialog\",\"jira.export.excel.enabled\",\"com.atlassian.portfolio.classicPlans.sunset\",\"com.atlassian.rm.portfolio.vertigo.issueloading.Database\",\"com.atlassian.portfolio.integrations.ClassicPlans.disable...

Also the only rule actions I have (apart from some audit logs previously in the rule) are:

  • Web request (as above)
  • log {{webResponse.statusCategory}} - passes with SUCCESS
  • Web request (as above)
  • log {{webResponse.statusCategory}} - fails and kills the rule
  • Web request (as above)
  • log {{webResponse.statusCategory}}
  • Web request (as above)
  • log {{webResponse.statusCategory}}

Please advise? Thank you

Guy Anela May 12, 2023

Hi @Yatish Madhav - That's odd. There's definitely something going on with that second request. Does it fail at the Send Web Request or when you're trying to Log the response?

If you haven't done so already, try moving the second Send Web Request so it's the first one executed and see if it still fails. 

Also, make sure you have this option enabled on your Send Web Request Actions...

JIRAAutomationWaitForResponse.png

Yatish Madhav
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.
May 19, 2023

Thanks for the reply @Guy Anela  - apology for the delay reply.

I tried moving the 2nd web request to being the 1st and it fails with "403: {"error": "Failed to parse Connect Session Auth Token"}"

I deleted the rule and recreated it with just 1 web request to create 1 sprint. It worked.

I created a 2nd web request with same details except for a sprint start and end date a week later and new name. I got this 403: {"error": "Failed to parse Connect Session Auth Token"}

I moved that 2nd one to be the 1st one and I got 403: {"error": "Failed to parse Connect Session Auth Token"} again

Also, I did ensure that the Autorization: Bearer XXXXXXX token, Content-Type, Accept headers are all exactly the same

Please advise?

Thank you

Guy Anela May 26, 2023

That's very odd. there definitely seems to be something wrong with the content of that second Web Request. When you recreated the Automation Rule so it only had one Web Request (the one that worked), was that with the same Web Request configuration/content that was previously failing?

Can you post a screen shot of the Web Request configuration that's failing?

Kaniawati Zainal Abidin January 16, 2024

hi @Guy Anela 

 

Need your advice here. I'm very knew with Jira and need to make an automation to create a Sprint Epic for each future Sprint 4 weeks ahead.  Each sprint is 2 weeks duration (starting 1 Jan 2024 and end 14 jan 2024 as the 1st Sprint Week 01 2024 then 15 jan 2024 till 28 jan 2024 as our 2nd Sprint Week 03 2024). The query is similar ti the initial but i just need to do the creation (no need automation for closure). I understand from the post to use the Send web request Action, but i do not understand how to get the details for the https field, the header part and how/where to know "originBoardId" details within my project.

 

Thanks in advance

Screenshot 2024-01-16 165906.jpg

Kaniawati Zainal Abidin March 24, 2024

Hi @Guy Anela @Guy Anela @Guy or anybody that can advice

 

I am new with jira. Appreciate your guidance as I need to make an automation to create a Sprint Epic for each future Sprint 4 weeks ahead.  Each sprint is 2 weeks duration (starting 1 Jan 2024 and end 14 jan 2024 as the 1st Sprint Week 01 2024 then 15 jan 2024 till 28 jan 2024 as our 2nd Sprint Week 03 2024).

The query is similar to the initial but i just need to do the creation (no need automation for closure). I understand from the post to use the Send web request Action, but i do not understand how to get the details for the https field, the header part and how/where to know "originBoardId" details within my project.

 

Thank you in advance

Guy Anela March 25, 2024

Hi @Kaniawati Zainal Abidin - When you view the Board in JIRA, the ID will be in the URL...

BoardID-Screenshot.png

 

In regards to this "Authorization" Header information...

 

WebRequest AuthorizationHeader.png

See the following Community post for more details and how to Encode it...

I hope this gets you further along on your JIRA journey. :) ...Cheers!

Kaniawati Zainal Abidin March 25, 2024

Hi @Guy Anela

Thanks for your feedback.

Another question as if you noticed my screenshot for "send web request", i do not actually understand when mention "you would Base64 Encode..." is it i have to use a program to Base64 it?

 

Also as you have the experience, can help suggest me the simplest approach (as a newbie to understand step flow easier) to create an automation that create an Epic which occurs for each future Epic 4 weeks ahead with Epic naming convention "Sprint Week X" whereby X is the calendar week of year 2024 (eg. 1 jan 2024 is Week 1, 15 jan is Week 3, 25 March is Week 13). Is there way without using "send web request"? i tried using schedule and create issue as per screenshot) but the rule does not seems to do anything even with the scheduler.creatre_epic2.jpgcreatre_epic1.jpg

 

Much appreciate your suggestion. Thanks in advance.

Guy Anela March 26, 2024

Hi @Kaniawati Zainal Abidin - Yes, you have to use a program to encode it. As suggested in this Community post, you can use this Base64 encode site.

In regards to your Automation, I would check the Automation Audit Log to see if there are any errors that give you a clue as to why it's not creating the Epics for you. I'm only speculating, but my guess is it's failing because you have the Create Issue Action set to "Same Project"...

EpicCreateIssue.png

I'm guessing it doesn't have context since it's Scheduled trigger; therefore, it doesn't know which Project to create the Epic in. Try setting it to a specific Project. Also, if the Epic has any required fields, you'll want to make sure you're setting those as well.

Also, to include the week of the year in the Epic Name, you can use {{now.weekOfYear}}. Here's an example of what it would look like...

WeekOfExample.png

NOTE: I used Summary in the example above since Atlassian seems to be moving away from using Epic Name.

Again, I hope this helps. Cheers!

Like Kaniawati Zainal Abidin likes this
1 vote
Pramodh M
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 31, 2022

Hi @sim.sisavuthary 

There's no Sprint Create Action in Automation for Jira as of now

Reference here - https://community.atlassian.com/t5/Jira-questions/Jira-Automation-Create-new-sprint-with-issue-in-it/qaq-p/1524548

Thanks,
Pramodh

0 votes
Foram Choksi December 27, 2023

hi @[deleted] 

I am project Manager and working with JIRA since 10+ years. However I am very new to JIRA automation and would like to learn more about it. 

If you can please help me with starting point, with some online links to refer, it will be very helpful. 

 

Thanks,

Foram 

Suggest an answer

Log in or Sign up to answer