How to do it...

Once you have installed the ScriptRunner for Jira add-on, we will first need to create what is known as a behavior:

  1. Log into Jira with a user that has a Jira administrator's permission.
  2. Navigate to Administration > Manage apps > Behaviors.
  3. Create a new behavior by entering a name for it and clicking the Add button.

With the new behavior created, we need to first create a mapping, so Jira will know what to apply the behavior to:

  1. Click on the Add Mapping link of the new behavior we have created.
  2. Select the projects and issue types you want to apply the behavior to. If you want this to be global, you can select the All projects and All issue types options.
  3. Click the Add Mapping button to save the setting.

With the mapping created, we can now start setting our field-level permission behaviors:

  1. Click on the Fields link of the new behavior we have created.
  2. Select the fields you want to apply field-level permissions to.
  3. Toggle the available behavior options on and off, as shown here:

  1. Click on the Add new condition link and select which users the permission should be applied to. In the following screenshot, the permission will be applied to everyone except users in the jira-administrators group:

  1. Click on the Add button to add the condition.
  2. After you are done with adding fields and conditions, click on the Save button.

Once we have created and configured our field-level permissions, the changes will be applied immediately to the target issues according to the mappings we have configured. Have a look at the next screenshot:

As you can see, the Description field (a system field) and the Team field (a custom field) are in read-only mode when a user is editing the issue.