/
Jira Software Functions
Jira Software Functions
Please note that some of the epic operations do not work on next-gen projects.
The cloud version uses the following structures:
JSprint
int id; //sprint id
string name; //sprint name
date startDate; //start date, may be null
date endDate; // end date, may be null
date completeDate; // non-null only for completed sprints
string goal; //goal of the sprint
state state; //active, future, completed
int boardId; // the board id it belongs to
JBoard
int id; // the id of the board
string name; //name
string type; //kanban, scrum, simple
JEpic
int id; // id of the epic
string name; // name of the epic
string summary; // summary
boolean done; // true if this is a done epic
Example 1
The following plans a sprint directly from the backlog issues which have the Story Points field set.
const int MAX_SP = 10;
//get all the boards
JBoard [] boards = getAllScrumBoards("PROJECT"); //change your project key here
if(size(boards) == 0) {
return "NOT PLANNED. No such board";
}
//there can be only one, so we select the first:
JBoard board = boards[0];
//select issues from backlog with SP set, according to their priority, not Rank
string [] backlog = issuesInBacklog(board.id, "\"Story Points\" is not null ORDER by priority");
if(size(backlog) == 0) {
return "NOT PLANNED. No issues in backlog";
}
//create a new sprint
int sprintid = createSprint(board.id, "Auto planned sprint", "Goal is to demo this sprint feature.");
runnerLog("Created sprint");
int sum = 0;
int ndx = 0;
while(sum < MAX_SP && ndx < size(backlog)) {
string isskey = backlog[ndx];
addIssueToSprint(isskey, sprintid); //add that issue to the sprint
sum += %isskey%.#{Story Points}; //maintain the sum of SPs
runnerLog("Adding " + isskey + " into the sprint, total SP:" + sum );
ndx++;
}
//we will go a bit overboard those 10 points per sprint but doesn't matter, we'll get the idea. Feel free to
// improve this script, including trying to get a better fit or something. MAX_SP is not really a max.
return "PLANNED.";
Example 2
Installing the following listener on the Sprint Created event will allow you to create automatically recurrent issues:
JSprint sprint = getSprintFromEvent();
if(sprint == null) {
return; //avoid execution if run from SIL Manager
}
JBoard board = getBoardFromEvent();
if(board == null) {
return; //avoid execution if run from SIL Manager
}
if(!arrayElementExists(projectsForBoard(board.id), "TEST")) {
//we need to be on the TEST project, right ?
return;
}
//create here the issues, as many as you want. This example creates just one.
string k = createIssue("TEST", "", "Task", "This is a recurrent task. Each sprint has one");
addIssueToSprint(k, sprint.id);
Peacock
, multiple selections available,
Related content
issueInEpic
issueInEpic
Read with this
Predefined structure types reference
Predefined structure types reference
Read with this
getUserByFullName
getUserByFullName
Read with this
getEpic
getEpic
Read with this
Listeners Basic Configurations
Listeners Basic Configurations
Read with this
Pre-Defined JQL Functions
Pre-Defined JQL Functions
Read with this
Need support? Create a request with our support team.
Copyright © 2005 - 2025 Appfire | All rights reserved.