PCF - SIL User Picker

Table of Contents

How to configure the SIL User Picker custom field

To configure the SIL User Picker custom field, follow these steps:

  1. Log into your Jira instance as Administrator.

  2. Go to Administration > Custom Fields > Add Custom Field and select SIL User Picker custom field from the list.

  3. Follow the on-screen instructions.

    image-20240213-151826.png
  4. Go to the Configure link, and then click the Edit Field data settings link to edit the field. You will see the following screen:

    image-20240213-152048.png
  5. Go to the Script tab and type or copy and paste a SIL script that returns users. For example, “return getAllUsers()” (without quotes).

  6. Click Save. The script is associated with the current custom field. The values returned by the script are the values available for the custom field.

  7. To filter the returned users by Roles or Groups, go to the Filtering Strategy tab and set your filters.

  8. In the General tab, set a default value for the field.

In our example, the SIL User Picker custom field is configured to filter only users that are members of the jira-servicedesk-users and or jira-administrators groups.

How to use the SIL User Picker custom field

  1. Go to an issue and edit it. This is an example of what the field will display as:

     

  2. Select a user from the list of available users for the selection by entering at least two characters.

  3. Select the user and save the user to the current issue. The field value appears on the right side of the view issue screen, in the People section:

  1. Edit the field on the View issue screen by clicking on the inline edit icon next to the field to see suggested users filtered accordingly to the SIL script.

Other examples

This section contains more SIL scripts examples that you can use to configure your SIL user picker fields. With SIL, you can restrict the users selection to align with any criteria you need.

Issue Assignees

string[] assignees; assignees = addElementIfNotExist(assignees, assignee); string[] assigneeHistory = fieldHistory(key, "assignee"); for(number i = 1; i < size(assigneeHistory); i = i + 2) { string assigneeName = getElement(assigneeHistory, i); assignees = addElementIfNotExist(assignees, assigneeName); } return assignees;

Users in specific role

return usersInRole(project, "Developers");

Users in specific group

return usersInGroups("jira-developers");

Searching issues

When you create a new SIL User Picker custom field, the default searcher set is SIL User Picker and Group Searcher. This filters the available users for the custom field in issue navigator accordingly to the configured SIL script.

However, when using SIL issue specific variables in the script (for instance project, key, assignee, reporter), you have to use Jira's standard searcher User Picker and Group Searcher for that field, or otherwise you will not be able to select any value for filtering.

When using the SIL User Picker & Group Searcher, user suggestions in issue navigator will be retrieved based on the SIL script from the field's global configuration.

  1. Go to Administration > Custom fields.

  2. Click Edit for the custom field you want to modify.

  3. Choose the correct Search Template for your custom field.

  4. After you are finished modifying all the Search Templates for the custom fields, perform a re-index in Jira.

  5. After a searcher has been set for the SIL User Picker custom field, you can perform a search for all issues containing the value you want for that custom field.

     

For a more details about searching tickets in Jira, see the Searching for Issues tutorial.