JavaScript on Custom Field Description of JIRA 6.4

Custom JS existing on description of custom field is simply showing as description on screens. Existing functionality was broken on Create Issue screens. Is there any workaround?

2 answers

Remove JS from description and copy it as a JS file. Now call the custom JS file from announcement banner. it works.

Good approach. Exactly the same we did already since a few years and hence it - luckily - saved us during the update to JIRA 6.4.11 :-)

hi @srinivas

Looks like a promising solution. Can you please post an example of how I can call teh custom JS from announment banner?

I have the sample script here, which change sthe value of one custom field depending on other field's value. This once doesn't worked when the JS placed in Description.

"<script type="text/javascript">
appName = document.getElementById('customfield_14262');

target = document.getElementById('customfield_14261');


if (appName=="Bergen.Service) {
target.value = "bergen  service"

}
</script>"

 

 

0 votes
Boris Berenberg Community Champion Apr 14, 2015

We disabled this on purpose: https://confluence.atlassian.com/display/JIRA/Fields+Allowing+Custom+HTML+or+JavaScript You can use a plugin to deliver custom JS if you need to. 

Looks like the website was down so I am not sure what it was on the mentioned page. Can we enable this again? One question: Cant we use JS on any existing JSP pages or on Announcement Banner?

Boris, I tried many times but the site is down. Could you please point any other page if that was available?

Boris Berenberg Community Champion Apr 16, 2015

The site is not down, I just tested it. I would suggest trying to access it from a different connection? Or maybe something is busted with your Atlassian ID account, try viewing it in an incognito window.

Hi Boris, I am able to access the site on different browser. Could you please provide some more details about plugin to deliver custom JS?

We have custom JS on some of description fields, actually copies reporter user field value to some custom fields. Could you please suggest any workaround to achieve this functionality?

Boris Berenberg Community Champion Apr 17, 2015

You would need to write a standard P2 (not connect) JIRA plugin to inject Javascript. I am not familiar with the exact how to for this as I am not a dev, but I know this is how we deliver custom JS on some of our instances. The only workaround I have is to do this via post functions where you can, and write a custom plugin to inject JS where you can't.

Post functions does not help us since we need to call the JS on page load of Issue Create.

Boris Berenberg Community Champion Apr 17, 2015

This is what you would use to load JS: https://developer.atlassian.com/jiradev/jira-architecture/building-jira-add-ons/jira-plugins2-overview/jira-plugin-module-types/web-resource-plugin-module Some Googling around says https://marketplace.atlassian.com/plugins/de.communardo.atlassian.plugins.cute may also do this, but I don't know for sure. Would be important to trial and test first to see if it can help you inject the JS where you need.

Hi Boris, I got a simple work around. Now custom JS is also calling from announcement banner. I was not able to call JS on Create Issue dialog with the earlier versions from announcement banner but on JIRA 6.4 it is working. Thanks for sharing the links.

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,811 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