Confluence - JIRA Macro insert button not working
Asked by Sebastien Falardeau:

Hello,

I have a problem that is affecting the JIRA Macro plugin for Confluence. Searching for an issue is giving me results without any problems but the "Insert" button is not doing anything at all. I've tried with another browser (IE) and the behavior is almost the same except that the "Insert" button is grayed out instead of not doing anything. I'm able to insert an issue using the "Create New Issue" and "Recently Viewed" tabs.

While searching similar issues on the web, I've come across a forum talking about using CTRL-Shift-J in Firefox to see the Browser Console. After doing so, the error "TypeError: f is undefined" appears refering to "batch.js:7535".

When I click on the "batch.js:7532" link, it shows me this error:

```
AJS.Editor.JiraConnector.Panel=function(){};AJS.Editor.JiraConnector.Panel.prototype={insertIssueLink:function(a){this.insertIssueLinkWithParams({key:a})},insertJqlLink:function(a){this.insertIssueLinkWithParams({jqlQuery:a})},insertIssueLinkWithParams:function(f){var d=AJS.$;var g=function(h){tinymce.confluence.macrobrowser.macroBrowserComplete(h)};f.server=this.selectedServer.name;f.serverId=this.selectedServer.id;if(AJS.Editor.inRichTextMode()){g({name:"jira",params:f})}else{var a="{jira:";for(var b in f){a=a+b+"="+f[b]+"|"}if(a.charAt(a.length-1)=="|"){a=a.substr(0,a.length-1)}var e=d("#markupTextarea");var c=e.selectionRange();e.selectionRange(c.start,c.end);e.selection(a);c=e.selectionRange();e.selectionRange(c.end,c.end)}AJS.Editor.JiraConnector.closePopup()},disableInsert:function(){AJS.$(".insert-issue-button").disable()},isInsertDisabled:function(){return AJS.$(".insert-issue-button").is(":disabled")},getOAuthRealm:function(d){var b=d.getResponseHeader("WWW-Authenticate")||"";var a=/OAuth realm\=\"([^\"]+)\"/;var c=a.exec(b);if(c){return c[1]}else{return null}},enableInsert:function(){AJS.$(".insert-issue-button").enable()},msg:function(a,c,b){if(aui&&aui.message){try{var h=AJS.$('<div class="aui-message-container"/>');var f=c;if(c.html){f=c.html()}var i={content:f};var d;switch(b){case"error":d=aui.message.error(i);break;case"success":d=aui.message.success(i);break;case"warning":d=aui.message.warning(i);break;default:d=aui.message.info(i)}h.append(d);c=h}catch(g){if(AJS&&AJS.logError){AJS.logError("jira-connector",g)}}}a.append(c)},errorMsg:function(a,c){this.removeError(a);var b=AJS.$('<div class="jira-error"></div>').appendTo(a);this.msg(b,c,"error")},warningMsg:function(a,b){this.removeError(a);var c=AJS.$('<div class="jira-error"></div>').appendTo(a);this.msg(c,b,"warning")},noServerMsg:function(a,b){var d=$('<div class="data-table jiraSearchResults" ></div>').appendTo(a);var c=AJS.$('<div class="message-panel"/>').appendTo(d);this.msg(c,b,"info")},ajaxError:function(c,b){if(c.status==401){var a=this.getOAuthRealm(c);this.selectedServer.authUrl=a;b.call(this)}else{this.errorMsg(this.container,"Received the following HTTP error code from the server"+":"+c.status)}},removeError:function(a){AJS.$("div.jira-error",a).remove()},setActionOnEnter:function(a,c,b){a.unbind("keydown").keydown(function(d){if(d.which==13){var f=function(g){a.unbind("keyup",f);c(b);return AJS.stopEvent(g)};a.keyup(f);return AJS.stopEvent(d)}})},createOauthForm:function(e){var d=this.selectedServer;var c={onSuccess:function(){d.authUrl=null;e(d)},onFailure:function(){}};var a='<a class="oauth-init" href="#">'+"Login & Approve"+"</a> "+"to retrieve data from"+" "+AJS.escapeHtml(this.selectedServer.name);var b=AJS.$('<div class="jira-oauth-message-marker"/>');if(!(aui&&aui.message)){b.addClass("oauth-message")}this.msg(b,a,"info");AJS.$(".oauth-init",b).click(function(f){AppLinks.authenticateRemoteCredentials(d.authUrl,c.onSuccess,c.onFailure);f.preventDefault()});return b},applinkServerSelect:function(a,b){var c=AJS.Editor.JiraConnector.servers;AJS.$(c).each(function(){var d="<option ";if(this.selected){selectedServer=this;d+='selected="selected"'}d+='value="'+this.id+'"></option>';d=AJS.$(d);d.text(this.name);AJS.$(a).append(d);d.data("jiraapplink",this)});AJS.$(a).change(function(g){var d=AJS.$("option:selected",a);var f=d.data("jiraapplink");b(f)})},showSpinner:function(d,a,c,b){AJS.$.data(d,"spinner",Raphael.spinner(d,a,"#666"));if(c){AJS.$(d).css("marginLeft",-a*1.2)}if(b){AJS.$(d).css("marginTop",-a*1.2)}},hideSpinner:function(a){AJS.$(a).css("marginTop","");AJS.$(a).css("marginLeft","");var b=AJS.$.data(a,"spinner");if(b){b();delete b;AJS.$.data(a,"spinner",null)}},setSelectedIssue:function(a){this.selectedIssue=a;this.enableInsert()},insertSelected:function(){if(this.selectedIssue){this.insertIssueLink(this.selectedIssue.key)}},createIssueTableFromUrl:function(c,l,b,a,d,i,j,g,e){var f=AJS.$;f("div.data-table",c).remove();var k=f('<div class="data-table jiraSearchResults" ></div>').appendTo(c);var m=f('<div class="loading-data"></div>').appendTo(k);this.removeError(c);this.showSpinner(m[0],50,true,true);var h=this;this.currentXhr=AppLinks.makeRequest({appId:l,type:"GET",url:b,dataType:"xml",success:function(r){m.remove();var s=f("item",r);AJS.$(":disabled",c).enable();if(s.length){var v=f('<table class="my-result aui"></table>');f(".jiraSearchResults",c).append(v);var p=[];if(e){var u={className:"issue-checkbox-column",title:'<input type="checkbox" name="jira-issue-all" checked/>',renderCell:function(z,x){var y=Confluence.Templates.ConfluenceJiraPlugin.issueCheckbox({issueKey:x.key});AJS.$(y).appendTo(z)}};p.push(u)}var t=[{className:"issue-key-column",title:"Key",renderCell:function(z,y){var x=Confluence.Templates.ConfluenceJiraPlugin.issueKey({issueIconUrl:y.iconUrl,issueKey:y.key});AJS.$(x).appendTo(z)}},{className:"issue-summary-column",title:"Summary",renderCell:function(y,x){y.text(x.summary)}}];p=p.concat(t);var n=new AJS.DataTable(v,p);f(s).each(function(){var x={iconUrl:f("type",this).attr("iconUrl"),key:f("key",this).text(),summary:f("summary",this).text(),url:f("link",this).text()};n.addRow(x)});v.bind("row-action",function(y,x){d.call(h,x)});v.bind("row-select",function(y,x){a.call(h,x)});n.selectRow(0);if(j){var o=f("issue",r).attr("total");j.call(h,o)}}else{if(i){i()}var w="No search results found.";var q=AJS.$('<div class="message-panel"/>');h.msg(q,w,"info");f(".jiraSearchResults",c).append(q)}},error:function(n){AJS.$(":disabled",c).enable();m.remove();g.call(h,n)}})},retrieveJson:function(c,a,d,b){AppLinks.makeRequest({appId:c,type:"GET",url:a,dataType:"json",success:d,error:b})},};
```

Here's our environment's information and what we've tried so far:

Windows Server 2008 R2  
JIRA 6.1.3  
Confluence 5.4.1  
Firefox 27  
Chrome 27  
IE 9

- Add JIRA and Confluence to trusted sites  
- Clear plugins cache folders  
- Recreate the Application Links  
- Bypass de Proxy  
- Safe Mode in JIRA and Confluence

Thank you for your time.  
Sebastien


Answers:
author: Sebastien Falardeau
body: This was fixed by Atlassian. This was a bug with a custom field's translation and they'll fix it in an enventual release.

Thank you


Tags: confluence-administration