Heads up! On March 5, starting at 4:30 PM Central Time, our community will be undergoing scheduled maintenance for a few hours. During this time, you will find the site temporarily inaccessible. Thanks for your patience. Read more.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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 Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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