Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I need assistance for Jira behaviour script runner

Priyadarshini Mishra
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 27, 2024

I want to execute the below bahaviour script in my form.There is no error in the script, but it does not work on the form.

Also this shows type error when I copy the code in console tab.I amusing script runner 8.36 version.

Could you please help?

 


def priorityField = getFieldById(getFieldChanged()) // field this behaviour script is defined on
def status=priorityField.getValue()
def priorityReason =getFieldById("PriorityReason")
if (status == "Blocker") {
priorityReason.setRequired(true)
priorityReason.setHelpText("Please provide reason behind the blocker")
}
else {
priorityReason.setRequired(false)
priorityReason.setHelpText ("")

}


1 answer

0 votes
Tuncay Senturk
Community Champion
December 28, 2024

Your script looks correct, did you verify the IDs of the fields?

  • Ensure that getFieldById(getFieldChanged()) refers to the field the Behaviour is applied to,
  • getFieldById("PriorityReason") the PriorityReason is correct. I'd suggest using the ID value

 

def priorityField = getFieldById(getFieldChanged())
def status = priorityField.getValue()

def priorityReason = getFieldById("customfield_12345")

if (status == "Blocker") {
priorityReason.setRequired(true)
priorityReason.setHelpText("Please provide a reason behind the blocker")
} else {
priorityReason.setRequired(false)
priorityReason.setHelpText("")
}

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events