Automatically move unresolved issues to next sprint and update story points

Problem

You're required to run an administration script that moves unclosed issues from the previously closed sprint to the current sprint, if available. If there's no ongoing sprint, these issues should be moved to the next sprint. Additionally, the script updates the story points by using the remaining estimated points.

Solution

Creating a SIL script file

To create a SIL script file,

  1. Log in as a Jira Administrator.

  2. Navigate to Administration > Add-ons > Power Plugins Configuration > SIL Manager. Right-click the silprograms folder in the left panel of the SIL Manager, and click New.

  3. Select the New > File option and type your new script file name. Remember to add the .sil extension. Save the name by checking the input box, and enter this SIL™ code into the right panel.

     

    NewTestFil.sil

    string message=""; string brd=getElement(argv, 0); number lastClosedSprint=0; number nextSprintInSprints=-1; string unclosedIssues=""; string[] closedIssuesInClosedSprint; if (isNull(brd)) { message = "Missing parameter: Board name."; return message; } lastClosedSprint=getElement(closedSprints(brd),size(closedSprints(brd))-1); if (size(notStartedSprints(brd))>0) { nextSprintInSprints=getElement(notStartedSprints(brd), 0); } closedIssuesInClosedSprint=selectIssues("sprint = " + lastClosedSprint + " AND status = 'Closed'"); for (string iss in closedIssuesInClosedSprint) { removeIssueFromSprint(iss, lastClosedSprint); if (isNotNull(startedSprints(brd))) { addIssueToSprint(iss, getElement(startedSprints(brd),0)); } else { if(nextSprintInSprints>-1) { addIssueToSprint(iss, nextSprintInSprints); } } if (isNotNull(%iss%.originalEstimate) and originalEstimate!=0 and isNotNull(%iss%.estimate)) { interval originalInterval=%iss%.originalEstimate; interval remainingInterval=%iss%.estimate; number points =#{%iss%.Story Points}; number originalMillies = originalInterval["TOMILLIS"]; number remainingMillis = remainingInterval["TOMILLIS"]; number newPoints=round(points * remainingMillis / originalMillies, 0); #{%iss%.Story Points}=newPoints; } unclosedIssues = unclosedIssues + ", " + iss; } if (startsWith(unclosedIssues, ", ") ) { unclosedIssues=substring(unclosedIssues, 2, -1); } message = "Unclosed issues " + unclosedIssues + " were removed from Sprint " + lastClosedSprint + " and added to Sprint " + nextSprintInSprints + "."; message = message + "Story points have been updated."; return message;
  4. Click Check to validate the syntax and Save your file.

Configure and Run the SIL™ Runner Gadget

  1. Add the Power Scripts™ for Jira gadget on your dashboard.

  2.  Edit the script from the up-right corner arrow. Add the new script that needs to be executed and configure it.

  3. Click Save to save the Configuration. You can now run this script as a Jira Administrator. To run the script, add the board name as a parameter and click Run.