Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Javascript functions are not calling in the production.

Suresh May 25, 2015

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.

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Gabor Nagy _Midori_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2015

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 )

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2015

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.

Suresh May 25, 2015

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>

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2015

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

Suresh May 26, 2015

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,

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2015

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.

Suresh May 27, 2015

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,

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 27, 2015

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.

Suresh May 27, 2015

I am sorry Nic..typo mistake..JS code is not at all appearing in the Dev Tools HTML section. Thanks for the help.

0 votes
Suresh May 25, 2015

I am not getting error.Just Scripts are not calling some times.

0 votes
Gabor Nagy _Midori_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2015

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)?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events