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

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,754 views 11 18
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot