Heads up! ScriptRunner documentation is moving to docs.adaptavist.com. Adaptavist will keep this site up for a bit, but no future updates to documentation will be published here. ScriptRunner 6.20.0 will be the last release to link to scriptrunner.adaptavist.com for in-app help.

Make a field read-only except for a certain role

This example shows you how to make a field read-only to all users except those with a specified role.

Behaviour conditions work as follows:

  • If any of the When conditions are true, the field behaviour applies.

  • If there are Except conditions, and if any of those are true, the behaviour does not apply.

You have a behaviour with an Original Estimate field. This field should only be editable by users in the Administrators role. Follow the steps below to set permissions on a field.

  1. Add a field to your behaviour. Here we add an Original Estimate field.

  2. Toggle the Writable option, so it shows as Read-only.

    field read only
  3. Click Add new condition…​.

  4. Select Except on the Add Condition window.

  5. Select User in project role:.

  6. Choose Administrators from the drop-down.

    except project admin
  7. Click Add.

The Original Estimate field is now read-only, except when the current user is in the Project Administrator role for the project containing the issue. It’s possible to add the same field twice to a behaviour.

Have questions? Visit the Atlassian Community to connect, share, and learn with other Atlassian users and experts, including Adaptavist staff.

Ask a question about ScriptRunner for JIRA, Bitbucket Server, or Confluence.

Want to learn more? Check out courses on Adaptavist Learn, an online platform to onboard and train new users for Atlassian solutions.