is it still possible to inject javascript in custom field descriptions like in JIRA 6?
This documentation is just for version 6.4 or lower:
https://confluence.atlassian.com/jira064/fields-allowing-custom-html-or-javascript-720415974.html
Yes, you can.
could you please show how ?
put in the description like 6.4 does not get translate out to the final page code ...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is the same way as in 6.4. Make sure your field description is updated in the correct field configuration. You can also check by changing the wordings on the description to test.
Also check your javascript to make sure it is correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Scriptrunner includes a module called "Behaviors" which allows you to show/hide fields at will. Scriptrunner also lets you define arbitrary web resources, so you could load various JS files in certain contexts. This is only avaliable for JIRA Server.
If you use service desk, you can use Extension for Service Desk to show/hide fields on the Customer Portal.
Atlassian has disabled javascript in JIRA Cloud. It should still work in JIRA Server, but Atlassian has stated that they plan to remove it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't have an answer, I'm writing to find out why this isn't working for me in our internally hosted JIRA 7.3 instance. I have successfully used JavaScript with custom fields in years past (like JIRA 5-6). In this case, when I'm adding JS code to the description for a field in the configuration, all that's happening is that the code block is displaying beneath the field name. This occurs whether I add the block by starting with <script type="text/javascript"> or if I use <script type="text/javascript">
In either case, I just end up with the script block displaying in the Description area beneath the custom field in the chosen configuration, and no code gets executed. Any ideas on what might be wrong? I'd guess something in the system is set up to not render the code as code, but I'm not sure where such a thing might get configured. Any ideas would be helpful.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes - Atlassian are removing the ability to execute arbitrary code such as javascript in descriptions, as they're a security (and sometimes, stability) risk. It's not configurable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well...ok then! :)
I get that they're a security issue, no argument there. Is there another mechanism to accomplish the same effect? In my specific case I want to show and hide fields based on the value selected from a custom select list.
Since posting my question I've gone into the system settings and I see that there's a value for "Enable HTML in custom field descriptions and list item values". In our case it's off, so I was thinking this might be why I'm having my problem. But it sounds from your response Nic as though this mechanism just doesn't work at all now.
Thanks for the update, I'll try to find another method to accomplish my goal.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That setting will enable html markup, but not scripting.
As far as I can tell, the only javascript you can inject now has to go into the announcement banner. Or, you can use add-ons to get it in there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nic,
We are upgrading Jira 6.3.9 to Jira 7.0.0, but after installation of Jira 7.0.0 there is no Javascript folder available under sources of chorme dubbugger.
As there is no JS folder, We unable to load our customised code of javascript, so we stuck there, and can't move forward.
Does Jira 7.0.0 support direct javascript ? OR we need some alternate way.
Thanks,
Orion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, as I said earlier, it's being removed.
You will have to bundle your javascript into an add-on and deploy it properly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nic,
Thanks for your quick response.
Can you please suggest any suitable addon to load javascript for Jira 7.0.0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Best advice - don't. It's hard to maintain, harder to get right and generally the wrong solution.
If you insist on doing it, then building your own add-on is the only real way to do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Nic,
I have created custom plugin for Javascript but unable to load javascript.
We need to call that plugin using some event like onClick, onLoad which loads event for that page only, But we required javascript through out in my application.
So Custom plugin is not working.
Please suggest if you have any other solution.
Thanks,
eClerx Orion.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm afraid the fix is to get your javascript injected correctly. Or better, stop using it, as it's probably the wrong solution to whatever you're trying to do with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I know it's a bit old thread, but still hot - at least for me. @Nic Brough -Adaptavist- - I've got a little lost in what you're saying. I understand that putting javascript in the custom field description is not the right way to do it. But is it a wrong customization method to include javascript in a plugin? Because that is what I get from your last comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes. Although adding .js via an add-on is a better way to do it that trying to get it into the UI directly, it is often a bad thing to do because it can easily clash with core js and break all sorts of stuff. If you must do it, have a good read of the aui guidelines and the js docs in the developer guides.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for clarification! So one more question - what would you recommend for Jira customization? I'm running an instance for 25 users and I try to avoid using multiple 3rd party add-ons, but sometimes to get what I need I have to customize. What would be the right way for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd strongly recommend using add-ons. You can disable them easily if you have problems and need support (any hacks to the core or injected js render your Jira unsupported), and most are written by experts in Atlassian software.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We use the JIRA server 7.5 version.
I'm new to JIRA customizing and have now a task to modifiy an existing multi-select-cf (plug-in). The list consists of a huge number of external values which are periodically updated. The cf is used frequently. So, thousands of values in customfieldvalue table are connected to the cf. Due to the high number of option values in the cf it's quite uncomfortable for my colleagues to use it without auto-completion.
I didn't find a way to add auto-completion until now. Maybe I still don't understand the concepts of JIRA automation enough for now. Although I tried to avoid JS-injection I now was attempted to do so...
...but reading this thread shows me that's not a good idea (as I assumed). So I'd highly appreciate your advice how to add autocompletion to the existing field without JS.
Thanks a lot in advance!
Isabelle Kuerwitz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As of JIRA server 8.1, the script injection into the description field worked for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Worth noting that in later versions the options is disabled by default, but can be enabled and works. I've tested with 8.11.0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register NowOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.