It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
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
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
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
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
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
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.
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
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
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) {
});
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreHey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.