we have written java script function to automate the some process.First we tested in the development and working fine..And later we moved those function to the production and those functions are not calling up on events on create screen.
we have written script functions inside field configuration
we have installed 6.3 jira version for both production and development.
we would like to know why the java script function are not calling.
Community moderators have prevented the ability to post new answers.
To check the console:
For the simplest approach, I would put some logging lines to the code to check that they are really executed, like that:
<script type="text/javascript">
console.log("Script block is called");
MessageApprover = document.getElementById('customfield_12905');
notifyMsgApproval = document.getElementById('customfield_12702');
document.getElementById('customfield_12801-1').onclick = function() {
console.log("onclick even was called");
if (this.checked) {
MessageApprover.value = AJS.params.loggedInUser;
notifyMsgApproval.value='Message Integration Change Security Group';
} else {
MessageApprover.value ='';
}
};
</script>
For more advanced features, you can also use the browser's debugger tool to insert breakpoints and watch expressions. This way you should be able to identify the problem. (For Chrome, see this guide: https://developer.chrome.com/devtools/docs/javascript-debugging )
The main question is probably "what is the difference between production and test"? If something works on one and not the other, you have an environmental problem you need to identify and address.
Check the javascript console and try out one of the advanced debuggers like Firebug, they should help you identify the differences.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We just found that even test instance also functions are not calling. We find similar issues behaviour in both dev,production instance. We have same versions in dev and production. can you tell me where can i find javascript console? In the script i am getting logged user and copying to other custom filed based check box click event.This scrielp will work some time.and some times it won't .please help on this. <script type="text/javascript"> MessageApprover = document.getElementById('customfield_12905'); notifyMsgApproval = document.getElementById('customfield_12702'); document.getElementById('customfield_12801-1').onclick = function() { if (this.checked) { MessageApprover.value = AJS.params.loggedInUser; notifyMsgApproval.value='Message Integration Change Security Group'; } else { MessageApprover.value =''; } }; </script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, if it's consistent between environments, then it's not that, and you need to start debugging the actual calls. You're going to find this quite hard though - the standard recommendation for injecting javascript into Atlassian applications is 1. Don't. Because it's a nightmare to get right, you usually miss places, the users can easily break it, and it has to be changed updated and hacked on every minor tweak you make, let alone an upgrade, and 2. If you must, then do it as part of an addon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have developed a jira plugin.And added above code to the JS file.And added path in web resource. But still function is not calling.i am keep on trying to find the problem.please let me know if you aware. Thanks Nic,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, that's good. First thing to check is that your .js crops up in the html - use the developer tools in your browser to get the source of the page and make sure the .js is in it. If it is there, check where and how it is called.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Js code is appearing in the Dev Tools HTML section.And even in the console output also i am not seeing scratching my head to find out solution. Thanks Nic,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also good, so the next thing is to look at where it is and when it's supposed to be called, and check if that's in the right place.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the exact error message you get? You can check the JS error logs and stack trace in the browser's console (by pressing F12 and selecting 'Console' in most browsers) Could you also post the relevant pieces of code here (JS code in brief, generated HTML perhaps)?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.