Hi,
We are planning to migrate jira4.4 to jira5.X in our organisation. we have implemented some of the customized functionality on custom fields through javascript. our script is working fine in jira4.4 but its not working in jira5.x. we have tried the below sites information but still not able to get the solution for this.
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
We would like to know is there any feature in Jira 5.x where the UI works like Jira 4.4. Can we acheive this by configuring any parameter in Jira 5.x.
Could you please suggest the solution for this.
try with following code if the first alert came then you need to check your logic
<script type="text/javascript"> jQuery(document).ready(function($) { JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) { callFunction(); }); callFunction(); function callFunction(){ alert("Test by Rambanam"); $('#customfield_12661').focus(function(){ onFocusFunction(); }); } function onFocusFunction(){ alert("in onfocus function"); var testdefect = document.getElementById("customfield_12660"); var w12 = testdefect.selectedIndex; var testvaldefect = testdefect.options[w12].text; var Maharashtra={"Select List": "-1", "Pune": "17890" ,"Nasik":"17158"}; var Karnataka = {"Select List": "-1", "Hubli": "17159" ,"Banglore":"17160"}; var phase={"Maharashtra": Maharashtra ,"Karnataka": Karnataka}; var value = new Object(); value = phase[testvaldefect]; var count=0; defectIdval.innerHTML = ""; for (var i in value) { defectIdval.options[count] =new Option(i,value[i]); count++; } } }); </script>
Hi Rambanam,
Thanks for your help.
I have tried this code but once i log out and login again the alert was not working for the first time. Second time its working fine.
Thanks,
Jayasingh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
on which screen you tried and where you added javascript? i mean in plugin or field configuration?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have created a custom field named state and city. In city custom field i have added this script inside field configuration. I havent used any plugin.
Thanks,
Jayasingh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
those fields are in create screen?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the javascript doesnt workin create screen while issuetype on change.
add javascript as web resource module in plugin then it will work in all screens.
i posted link im my first answer to know how to add javascript in plugin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
AWWWWWWWW........ Javascript Functionality working fine in jira5.0.7.
Thanks for your continuos support. The sample script helped us to resolve the long pending issue.
Now we set for the migration of jira from 4.4 to 5.0
Cheers,
Jayasingh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Jaya singh,
Threre is no way to configure any parameters to work javascript in 5.x as in 4.4 because the UI changed lot from 4.x to 5.x, so you have to change your script according to the 5.x UI
I added lot of javascripts on 5.x as specified in the following post and all are working fine,
https://answers.atlassian.com/questions/47843/strange-javascript-problem-in-create-screen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam ,
I have javascript which works when i place it in the announcement banner but it does not work when i embed it in a web resource plugin . Can you please help
refer my question here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
We have tried two scenario using plugin
1. Added web resource in atlassian-plugin.xml, Added JIRA.Events.NEW_CONTENT_ADDED and ajax based javascript inside the js file, removed javascript from field configuration.
after installing this plugin we are getting the output as below:
Output: At the time of issue creation ,when we clicked on Create Issue Link, it is opening new page same as old version of JIRA 4.4, we are able to see all the projects in the project dropdown and in the issue type dropdown we are getting all the project specific issue types.Dropdown functionality was working fine. But dropdowns w.r.to Dashboard, Issues, Project is not working. They are in disabled mode
2. Added web resource in atlassian-plugin.xml, Added JIRA.Events.NEW_CONTENT_ADDED and ajax based javascript inside the js file as well as in field configuration.
Output: At the time of issue creation, we are able to see all the projects in the project dropdown and in the issue type dropdown we are getting all the project specific issue types
Thanks,
Jayasingh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you share your code in js file and check that is there any error throwing javascript using firebug on firefox or javascript console on crome
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
Here is my javascript.
<script language="JavaScript" type="text/javascript">
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function (e,context) {
var defectIdval = document.getElementById("customfield_12661");
alert("Test by Jai");
AJS.$(function()
{
defectIdval.onfocus=function()
{
var testdefect = document.getElementById("customfield_12660");
var w12 = testdefect.selectedIndex;
var testvaldefect = testdefect.options[w12].text;
var Maharashtra={"Select List": "-1", "Pune": "17890" ,"Nasik":"17158"};
var Karnataka = {"Select List": "-1", "Hubli": "17159" ,"Banglore":"17160"};
var phase={"Maharashtra": Maharashtra ,"Karnataka": Karnataka};
var value = new Object();
value = phase[testvaldefect];
var count=0;
defectIdval.innerHTML = "";
for (var i in value)
{
defectIdval.options[count] =new Option(i,value[i]);
count++;
}
};
});
AJS.$(".defectIdval", context).live("change keypress keydown", onfocus);
});
</script>
Here we have created two custom fields as state and city. once the user select the field state as Maharastra. in city dropdown it should show pune and nasik. once user select state as Karnataka it should display Hubli and Banglore.
Thanks,
Jayasingh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you need to remove <script > tag from the js file
i.e remove <script language="JavaScript" type="text/javascript"> and </script> tags
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
Thanks for your input.
I have tried removing the script tags from the plugin but still no luck and i have tried all the alternative ways still not working.
Thanks,
Jayasingh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rambanam,
I have tried two ways as per your suggestion
1.Updating my script inside the plugin and left the field config blank
2. Updating my script inside the field config and adding the web resource and
JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED,
function
(e,context) {
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online 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.