Get Open Sprint id's created before an year ego using SIL script
Hello @Bhargavi Vasa ,
You can try something like this:
string format = "yyyy"; //format for datefor(JSprint sprint in getAllOpenSprints()) { if (formatDate(sprint.startDate, format) < 2023){ runnerLog("Sprint name: " + sprint.name); runnerLog("Sprint id: " + sprint.id); runnerLog("Sprint start date: " +formatDate(sprint.startDate, format)); } }
This will give you all Open Sprints before 2023, but if you mean not a calendar year but a year since now (today - 365 days) it needs some adjustments.
Please let me know if that works for you.Anna
Yeah it's working fine but can we get only the active sprints(i.e., sprint started) which are created 90 days before and get the open issues which are linked to that sprint and change the issue status to close and then close the sprints.
Can you please help on this scenario
Hi @Bhargavi Vasa This one should work for the described use case:
string format = "MM/dd/yyyy"; //format for datestring creationdate = currentDate()-"90d";runnerLog("creation date: " + creationdate);for(JSprint sprint in getAllOpenSprints()) {if (sprint.startDate < creationdate and sprint.state =="ACTIVE") {runnerLog("Sprint name: " + sprint.name);runnerLog("Sprint id: " + sprint.id);runnerLog("Sprint start date: " +formatDate(sprint.startDate, format));runnerLog("Sprint state: " +sprint.state);string [] keys =selectIssues("Sprint = '" +sprint.name+ "'");runnerLog("issues " +keys);for(string key in keys) {autotransition("Done", key);}updateSprint(sprint.id, sprint.name, "Closed" );runnerLog("Sprint was updated: " + sprint.name );}}
Please let me know how it goes. Anna
Hi @Anna Hryhoruk _Appfire_ Thanks for your code
This code is giving the output of all the issues even if they are closed and if they are not part of active sprints,getting all the issues from other sprints as well.
Iam looking for this below use case:
Scenario 1: Get all active/open sprints created before 3 months ago
Scenario 2: Get the issues which are not closed for "scenario 1"
Scenario 3: Close the issues which we got for "scenario 2"
Scenario 4: Close/Delete the Sprints for "scenario 1"
It looks like you're new here. Sign in or register to get started.