Custom JavaScripts in JIRA 5.1.3

Guys,

I used to use the beow script in JIRA 4.4.1 to alter the visibility of a custom field based on another one.

<script type="text/javascript">
priority = document.getElementById('priority');
if (priority) {
target = document.getElementById('customfield_10061').parentNode;
// Hide the target field if priority isn't a Blocker
if (priority.value != 1) target.style.display='none';

priority.onchange=function() {
if (this.value == 1) {
target.style.display = '';
} else {
target.value='n/a';
target.style.display='none';
}
}
}
</script>

The above script doesn't work with JIRA 5.1.3. Do I need to change anything in the script ?

Thanks, Vishnu.

4 answers

1 accepted

This widget could not be displayed.

Perhaps is the same case as in this question: How do you embed JavaScript for a custom field in Jira 5.x

Or, this documentation in the Atlassian Developers site may help: How do you embed JavaScript for a custom field in Jira 5.x

It works, sometimes doesn't. Anyway, thanks for the hint.

This widget could not be displayed.

Is it not working while editing? None of this will work with inline edit for sure.

It's not working even in the create issue screen :(

Is the javascript firing? Any error? Time for debugging ;)

No, it doesnt fire any error.

This widget could not be displayed.

Got it !!

It works when you create issue first time. It doesn't work if you use the new feature 'Create Anotther One' up on succession. The reason can be, new Jira doesn't reload forms but it just clear the forms for new issue creation.

Is there any workarround to fix this ?

This widget could not be displayed.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

169 views 1 3
Join discussion

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