Script runner problem: "You must enter a value for this field"

Hello,

we updated our JIRA test enviroment to JIRA version v6.3.15, recently. Script runner is installed as well (version 3.0.9) and replaced the behaviours plugin.

We are using a bunch of behaviour scripts. At least one them or a combination of all causing trouble, after the migration to script runner.

Creating an issue for a special issue type will trigger the error "You must enter a value for this field" under the component field.

error.png

 

Creating issues for other issue types isn´t a problem at all.

The behaviour for the affected component field is:

 

FormField FieldKomponente = getFieldById(getFieldChanged())   // Feld Komponente

FieldKomponente.setHelpText("<script type=\"text/javascript\">priority=document.getElementById(\'components\');\

  target = document.getElementById(\'customfield_11511\').parentNode;\

  target2 = document.getElementById(\'customfield_11511\');\

  if(priority.value==10101){target.style.display=\'\'}else{target.style.display=\'none\';target2.value = \"null\";}</script>")

 

I discovered 2 workarounds:

  1. Changing the "Guide Workflow" for an moment,at the behavior general settings for that issue type, fix the error for a while, but only for a while. <- Not reliable, does not work all the time.

      2. Switching the issuetype in the create screen from affected issue type to non affected issue type and back.<- Reliable

 

Both are not acceptable solutions for our production system.

Any ideas how to fix that problem permanent?

 

Thanks,

Benjamin

 

2 answers

0 vote

There's no need to mix javascript and groovy, that is just unmaintainable. If you're trying to hide or display fields based on another value just get the other field and call setHidden(true/false).

 

Thanks Jamie. Thats not my piece of code and actually I ´m not a developer. I tried this: FormField FieldRSSAusbaustufe = getFieldById ("customfield_11511") FormField FieldKomponente = getFieldById(fieldChanged) switch (FieldKomponente.getFormValue()) { case null : FieldRSSAusbaustufe.setHidden(true) break case "risk solution service" : FieldRSSAusbaustufe.setHidden(false) break } Do you have an hint where the error might be?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

292 views 4 9
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you