PCF - SIL Script Custom Field



Before using SIL Script Custom Field, see Simple Issue Language documentation for a better grasp of SIL usage and capabilities.

Configuring PCF - SIL Script custom field

  1. After you create the field, click the Configure link for this field. You will see the page like the following example:



  2. Click Edit SIL Script and the following screen will appear:



    Here you have two tabs: “General” and “Scripts”.

    1. The General tab. Here, you can set the formatting of the value under “Value formatted as”. It can either be “Script Template”, “Date” or “Date Time”, depending what your SIL script will return. You can set the field’s Refresh interval to “Always”, “Never” or “Specify interval”. Note that the refresh interval does not do a refresh on the field on that interval no matter what. Instead, when the value is needed, if the interval passed, the field will be recalculated. What that means is for example, if the Refresh interval is set to “Always”, and the field’s value reflects for example the current minute in the hour, when searching issues by the field's value, you have to search for the last value that was viewed in a non-editable place (E.G. View issue screen). If you search for the current minute, the value won’t be present in the search results.

    2. The Scripts tab.


      Here you have to set the field’s SIL script (the script that computes the value to be displayed), and optionally, the template (see SIL Template Language).

  3. Click Save, and the script is associated with the current custom field.


  4. The value returned by the script will be the value of the custom field:


The script is read-only. Please keep the following in mind:

  • You must avoid changing any issue values in the script. In fact, you can change the issue variables but they will not be changed (issue will not be saved). However, routines may have side effects.

  • This field only appears in non-editable places, like on the View screen of an issue or as a column in a JQL search

Usage examples

Seeing Issue Age

interval age = currentDate() - created; return "This issue is " + age + " old";

Showing the number of subtasks for a ticket

number noSubtasks = size(subtasks(key)); return "This issue has " + noSubtasks + " subtasks";

Showing average age for issue subtasks

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));

Displaying results from the database

Seeing how long a ticket is in the particular status

Displaying statuses count for a ticket

Seeing everyone who has ever been an Assignee for the ticket

Making SIL Script custom fields searchable

  1. Log into your Jira as Admin.

  2. Go to Administration > Custom fields, and click Edit for the necessary SIL Script custom field.

  3. Select a Search Template for that custom field according to the value type returned by it.



  4. If you are about to add a new SIL Script custom field, you can choose the Search Template at the custom field creation step.

  5. After changing the Search Templates for all the custom field that you want, perform a re-index in Jira for the search to work fine.

After you set a searcher for the SIL Script custom field, you can perform a search for all issues containing the desired value for that custom field.


See also

For more details on searching issues in Jira, see Searching for Issues tutorial from the Jira documentation.

See More