Hello @Bhargavi Vasa ,
You can try something like this:
string format = "yyyy"; //format for date
for(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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bhargavi Vasa This one should work for the described use case:
string format = "MM/dd/yyyy"; //format for date
string 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should give you all issue keys associated with sprints listed by :
runnerLog("Sprint name: " + sprint.name);
Based on the example I provided, I think you can easily modify it to give only issues in a specific state. Routine selectIssues uses just JQL as a parameter, you can read more about it here: https://appfire.atlassian.net/wiki/spaces/PSJ/pages/15487412/selectIssues
So just modify jql in line
string [] keys =selectIssues("Sprint = '" +sprint.name+ "'");
and add state jql condition which suits your use case.
If you need additional help, please feel free to submit support request here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
string format = "MM/dd/yyyy"; //format for date
string 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+ "'" and status not in Closed);
runnerLog("issues " +keys);
for(string key in keys) {
autotransition("Done", key);
}
updateSprint(sprint.id, sprint.name, "Closed" );
runnerLog("Sprint was updated: " + sprint.name );
}
}
I have tried this code by giving jql,but it is throwing error
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try the following syntax:
string [] keys =selectIssues("Sprint = '" +sprint.name+ "'" + "and status != 'Closed' ");
or
string [] keys =selectIssues("Sprint = '" +sprint.name+ "'" + "and status != 'Done' ");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
string format = "MM/dd/yyyy"; //format for date
string creationdate = currentDate()-"90d";
runnerLog("creation date: +creationdate);
for (JSprint sprint in getAllOpenSprints()){
if(formatDate(sprint.startDate, format) < 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 jql;
jql=("Sprint=' "+sprint.name+" ' " + "and status="Closed" ' ");
string [] keys = select Issues (jql);
runnerLog("issues " +keys);
for(string key in keys) {
updateSprint (sprint.id, sprint.name, "Closed");
runnerLog("Sprint was updated: +sprint.name);
This is the exact code I was running but unable to get the issues on the date given for above script, getting all the issues which are not part of those open sprints which has sprint starting date created before 90days.
Here I need to get the sprints created before an year ago which is having only the closed issues to close the Sprint
This is the logic I required for the code:
If sprint is open which has been created before 90 days ago and if the issues under that sprints are "open", close loop(avoid open issues) and in other loop get all the issues part of that sprints which were "closed" and close the sprint.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.