...
Go to the Administration page, choose Custom Fields link and add a SIL script custom field.
After you create the field, go to the corresponding Configure link. A page like in the image below will appear:
Click on the Edit SIL Script link to see the SIL editor.
Click on the Save button and the script is associated to the current custom field.
The value returned by the script will be the value of the custom field.
Now type in the SIL script a return value, for example: return priority;
Warning |
---|
The script is read-only. You must avoid changing any issue values in the script. |
Thread Local Caching
Note |
---|
If you are not fully aware of what this implies, it is recommended that you leave the option off. |
...
Go to an issue and this is how the value of the field is the value returned by the script.
That's it.
Other Examples
Issue Age
Code Block |
---|
interval age = currentDate() - created;
return "This issue is " + age + " old"; |
Number of subtasks
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)); |