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

0 votes
Accepted answer

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.

0 votes

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.

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 ?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,717 views 17 21
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