Hello!
I would like to have a text box appear based on what Priority (Jira standard field) is selected. So if Highest or High Priority is selected I need my text box (custom field) to appear. So if the Priority Is Medium, Low, or Lowest, I don't want that text box to appear. Can anyone help with this on ScriptRunner?
I have been able to accomplish this with other field types, but not drop down fields.
Thank you.
This is a use case of ScriptRunner's Behaviour. It field return a Priority object.
1. Navigate: ScriptRunner > Behaviour > create and edit your Behaviour > add "Priority" field.
2. Add following server-side script:
def currentPriority = getFieldById(getFieldChanged()).getValue().name
if (currentPriority == "Hightest" || currentPriority == "High") {
getFieldByName("Your Text Field").setHidden(false).setRequired(true)
} else {
getFieldByName("Your Text Field").setHidden(true).setRequired(false)
}
I assume once the text field is shown, it is also required.
Above snippet will show a static type checking error, but it will work fine. To eliminate it, you need to cast currentPriority to the proper class Priority.
Thank you so much! This will work for what we need! I appreciate your help. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.