Contents
Table of Contents | ||
---|---|---|
|
...
Warning |
---|
The script is read-only. You must avoid changing any issue values in the script. In fact, you may change the issue variables BUT they will not be changed (issue will not be saved). However, routines may have side effects. |
Thread Local Caching
Note |
---|
If you are not fully aware of what this implies, it is recommended that you leave the option off. |
...
Code Block |
---|
number noSubtasks = size(subtasks(key)); return "This issue has " + noSubtasks + " subtasks"; |
Average Issue Age
Code Block |
---|
date now = currentDate(); // just to make sure we use the same reference date string [] subtasks = subtasks(key); interval age; for(string task in subtasks){ age = age + (now - %task%.created); } return "Average age of subtasks is " + (age / size(subtasks)); |
Results from Database
Code Block |
---|
//select the city from the specified region return sql("TestSQL", "select city from cities c, district d, region r where c.iddistrict=d.id and d.idregion=r.id and r.region='Bucharest'"); |
Status Age
Code Block |
---|
string field_name = "status"; string[] field_history = fieldHistory(key, field_name); number n = arraySize(field_history); date startDate; if (n > 0) { startDate = arrayGetElement(field_history, n - 2); return "Current issue has been " + status + " for " + (currentDate() - startDate); } return "Current issue has been " + status + " for " + (currentDate() - created); |
Issue Statuses Count
Code Block |
---|
string[] statuses; string[] statusHistory = fieldHistory(key, "status"); for(number i = 1; i < size(statusHistory); i = i + 2) { string statusStr = getElement(statusHistory, i); statuses = addElementIfNotExist(statuses, statusStr); } return size(statuses); |
Issue Assignees
Code Block |
---|
string[] assignees; assignees = addElementIfNotExist(assignees, userFullName(assignee)); string[] assigneeHistory = fieldHistory(key, "assignee"); for(number i = 1; i < size(assigneeHistory); i = i + 2) { string assigneeName = userFullName(getElement(assigneeHistory, i)); assignees = addElementIfNotExist(assignees, assigneeName); } return assignees; |
...