Skip to end of banner
Go to start of banner

SIL Script Custom Field

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

How to configure

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.

 

The script is read-only. You must avoid changing any issue values in the script.

 

Thread Local Caching

If you are not fully aware of what this implies, it is recommended that you leave the option off.

Because multiple calls to get the value of a SIL Script Custom Field for a certain issue are inevitable, we implemented an option to generate the value only once per HTTP request. This can improve performance, but might have some side effects.

For example, if the value is generated before some other values it depends on are modified, the result might not reflect latest updates.

How to use it

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

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

 

Number of subtasks

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

 

Average Issue Age

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

  • No labels