You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Change Field's Requiredness and Visibility - ITSM


Set up a behaviour that changes the visibility of a field depending on the priority of an issue.

  • Navigate to Add-ons > Behaviours, using the Administration Cog in the top right corner.
  • Under Add Behaviour, enter a Name and Description.
  • Click Add.
  • Click on the Fields option for the newly created behaviour. Add the behaviour to the Priority field by choosing it from the drop-down list and clicking Add.
  • Select Add Server-Side Script.
  • The inline script should appear, paste this code snippet into it.


Detailed use case example: Adding Behaviours to The Customer Portal


  • Jira Jira (8.0 - 8.14)
  • ScriptRunner for Jira ScriptRunner for Jira (6.18.0)
import com.atlassian.jira.issue.priority.Priority import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript @BaseScript FieldBehaviours fieldBehaviours def priorityField = getFieldById(fieldChanged) def customField = getFieldByName("Number Field") def priorityValue = priorityField.value as Priority == "Highest" ? customField.setRequired(true).setHidden(false) : customField.setRequired(false).setHidden(true)
Discovered an issue? Report it here

Suggested for you