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 vote

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 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Posted 12 hours ago in Jira

We want to know what Jira Service Desk apps you're using!

Hi Community! My name is Amir and I’m on the Jira Service Desk product marketing team at Atlassian. Our team would love to understand how you’re leveraging our ecosystem for Jira Service Desk. Wha...

35 views 0 5
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