Create Issue from Agile Board throws exception

Loredana February 25, 2013

Hi all,

We updated JIRA recently to the Jira Version: v5.2.6. The GreenHopper Version is: 6.1.3.1

When we create Issue from the Agile Board (Plan) page, we get an exception like:

Exception: TypeError: $ is undefined.

at this huge line:

GH.BacklogController={};GH.BacklogController.visible=false;GH.BacklogController.rapidViewData=undefined;GH.BacklogController.rapidViewConfig=undefined;GH.BacklogController.backlogData=undefined;GH.BacklogController.lastExecutedSearchFilter=undefined;GH.BacklogController.issueCreatedCallbacks={};GH.BacklogController.init=function(){GH.BacklogSelectionController.init();GH.SprintBacklogController.init();GH.PlanRankController.init();AJS.$(GH).bind("issueUpdated",GH.BacklogController.handleIssueUpdated);AJS.$(GH).bind("issueCreated",GH.BacklogController.handleIssueCreated);AJS.$(GH).bind("issuesRemovedFromSprint",GH.BacklogController.handleIssuesRemovedFromSprint);AJS.$(document).delegate(".js-sprint-start","click",GH.BacklogController.openStartSprintDialog);AJS.$(GH).bind(GH.Dialogs.StartSprintDialog.EVENT_SPRINT_STARTED,GH.BacklogController.handleSprintStarted);AJS.$(GH).bind(GH.Components.EVENT_SPRINT_UPDATED,GH.BacklogController.handleSprintUpdated);AJS.$(GH.PlanControls.quickfilters).bind("quickFilterChange",function(){if(GH.BacklogController.visible){GH.BacklogController.loadData()}})};GH.BacklogController.setRapidView=function(A){GH.BacklogController.rapidViewData=A};GH.BacklogController.setRapidViewConfig=function(A){GH.BacklogController.rapidViewConfig=A};GH.BacklogController.show=function(A){if(!GH.BacklogController.rapidViewData){return false}GH.BacklogController.visible=true;GH.BacklogController.loadData().done(A)};GH.BacklogController.hide=function(){GH.EpicView.hide();GH.BacklogController.visible=false};GH.BacklogController.loadData=function(){var B={rapidViewId:GH.BacklogController.rapidViewData.id,activeQuickFilters:GH.PlanControls.quickfilters.getActiveQuickFilters()};if(_.isEmpty(B.activeQuickFilters)){delete B.activeQuickFilters}GH.PlanView.showLoadingBacklog();var A=GH.Ajax.get({url:GH.Ajax.buildRestUrl("/xboard/plan/backlog/data.json"),data:B,onGlobalError:function(){GH.PlanView.hideLoadingBacklog();GH.PlanController.hide()},jiraRestFormat:true},"backlogDataModel");A.done(function(C){GH.log("loaded data for backlog",GH.Logger.Contexts.ajax);GH.BacklogController.processData(C)});return A.promise()};GH.BacklogController.processData=function(B){if(!GH.BacklogController.visible){return }GH.BacklogController.lastExecutedSearchFilter=undefined;GH.BacklogController.backlogData=B;GH.BacklogModel.setRankCustomFieldId(B.rankCustomFieldId);GH.BacklogModel.setEstimationStatistic(GH.BacklogController.rapidViewConfig.estimationStatistic);GH.BacklogModel.setTrackingStatistic(GH.BacklogController.rapidViewConfig.trackingStatistic);GH.BacklogModel.setData(B);GH.SprintBacklogModel.setData(B);GH.BacklogModel.setCanManageSprints(B.canManageSprints);GH.BacklogSelectionController.validateCurrentSelection();GH.EpicView.registerEpicsCount(B.epicData);GH.EpicView.show();var A=GH.EpicController.getFilteredEpicKey();var C=A===GH.BacklogModel.EPIC_FILTER_KEY_NONE&&GH.BacklogModel.getIssueListForEpics().getNumVisibleIssues()>0||GH.BacklogModel.getIssueListForEpics().isIssueValid(A);if(C){GH.BacklogController.updateEpicFiltering(A,true)}else{GH.EpicController.setFilteredEpicKey(undefined);GH.RapidBoard.UrlState.replaceState()}GH.BacklogView.draw();GH.PlanView.updateDetailsViewVisibility();GH.PlanControls.searchFilter.clearLastSearch();GH.PlanControls.searchFilter.searchQuery();GH.PlanControls.setSprintData(B.openSprints,B.canManageSprints);GH.PlanView.hideLoadingBacklog();GH.PlanController.updateDetailsView(GH.BacklogSelectionController.getSelectedIssueKey());GH.BacklogView.updateIssueSelectionState(true)};GH.BacklogController.updateUIAfterSelectionChange=function(A){GH.BacklogView.updateIssueSelectionState(A.doScroll);GH.PlanController.updateDetailsView(GH.BacklogSelectionController.getSelectedIssueKey(),A.openDetailsView)};GH.BacklogController.reloadSingleIssue=function(B){var A={rapidViewId:GH.BacklogController.rapidViewData.id,issueId:B};GH.Ajax.get({url:GH.Ajax.buildRestUrl("/xboard/plan/backlog/issue.json"),data:A,success:function(C){GH.log("loaded data for single issue with id "+B,GH.Logger.Contexts.ajax);GH.BacklogController.updateIssues(C)},jiraRestFormat:true},"updateSingleIssue")};GH.BacklogController.updateIssues=function(B){if(!_.isArray(B)){B=[B]}var F=false;var C=[];var E=false;var D=false;_.each(B,function(G){var H=GH.BacklogModel.findListWithIssues(G.key);if(!H){return }if(GH.BacklogModel.isBacklogIssueList(H)){if(G.typeId===GH.EpicConfig.getEpicIssueTypeId()){H.removeIssues(G.key);D=true}else{H.updateIssue(G);E=true}}else{if(GH.BacklogModel.isEpicIssueList(H)){H.updateIssue(G);F=true}else{if(GH.BacklogModel.isSprintIssueList(H)){H.updateIssue(G);C.push(GH.BacklogModel.getSprintIdForSprintIssueList(H))}}}});GH.BacklogModel.reapplySearchFilter();C=_.unique(C);_.each(C,function(H){var G=GH.BacklogModel.getOpenSprint(H);GH.BacklogView.updateOpenSprint(G)});if(D){GH.BacklogSelectionController.validateCurrentSelection();GH.BacklogController.updateEpicData();GH.BacklogView.redrawBacklogIssueList();var A=GH.BacklogSelectionController.getSelectedIssueKey();GH.DetailsView.setSelectedIssueKey(A);GH.PlanController.reloadDetailView()}else{if(E){GH.BacklogView.redrawBacklogIssueList()}if(F){}}};GH.BacklogController.updateOpenSprint=function(A,B){if(!GH.BacklogController.visible){return }B=_.isUndefined(B)?true:B;var C={rapidViewId:GH.BacklogController.rapidViewData.id,activeQuickFilters:GH.PlanControls.quickfilters.getActiveQuickFilters(),sprintId:A};if(_.isEmpty(C.activeQuickFilters)){delete C.activeQuickFilters}return GH.Ajax.get({url:GH.Ajax.buildRestUrl("/xboard/plan/backlog/opensprint.json"),data:C,success:function(D){if(!GH.BacklogController.visible){return }GH.log("loaded data for single open sprint "+A,GH.Logger.Contexts.ajax);GH.BacklogController.setOpenSprintData(D,B)},jiraRestFormat:true},"opensprint")};GH.BacklogController.setOpenSprintData=function(A,B){GH.BacklogModel.updateSprint(A,true);if(B){GH.BacklogView.updateOpenSprint(A)}};GH.BacklogController.updateEpicData=function(){if(!GH.BacklogController.visible){return(new AJS.$.Deferred()).resolve()}var A={rapidViewId:GH.BacklogController.rapidViewData.id};return GH.Ajax.get({url:GH.Ajax.buildRestUrl("/xboard/plan/backlog/epics.json"),data:A,success:function(B){if(!GH.BacklogController.visible){return }GH.log("loaded data for epics",GH.Logger.Contexts.ajax);GH.BacklogController.setEpicData(B)},jiraRestFormat:true},"epics")};GH.BacklogController.setEpicData=function(A){GH.BacklogModel.updateEpicData(A);GH.EpicView.updateEpics()};GH.BacklogController.reorderIssues=function(B,A,C){GH.BacklogModel.reorderIssues(B,A,C);GH.BacklogView.draw()};GH.BacklogController.sendToBottom=function(A){GH.BacklogModel.sendToBottom(A);GH.BacklogView.draw()};GH.BacklogController.sendToTop=function(A){GH.BacklogModel.sendToTop(A);GH.BacklogView.draw()};GH.BacklogController.temporarilyMoveSprintMarker=function(C,B){var A={markerId:C,markerMovedAfter:B};GH.BacklogView.updateAllMarkerStatistics(A);GH.BacklogView.updateBacklogHeader();GH.BacklogView.updateOvertakenMarkers(A)};GH.BacklogController.updateSprintMarkersPosition=function(E,C){GH.BacklogModel.updateSprintMarkersPosition(E,C);var D={rankables:_.map(E,function(G){return{id:G,type:"sprintmarker"}}),customFieldId:GH.BacklogModel.getRankCustomFieldId()};var F;var A;if(C){if(_.isNumber(C)){D.rankAfterRankable={id:C,type:"sprintmarker"}}else{D.rankAfterKey=C}F="after";A=true}else{var B=GH.SprintBacklogModel.getIssueList();D.rankBeforeKey=B.getIssueKeyAtIndex(0);F="before";A=!!D.rankBeforeKey}if(A){GH.Ajax.put({url:GH.Ajax.buildRestUrl("/api/rank/"+F),data:JSON.stringify(D),contentType:"application/json",jiraRestFormat:true})}else{GH.log("Cannot rank marker as there is nothing to rank against")}GH.BacklogView.redrawBacklogIssueList()};GH.BacklogController.openStartSprintDialog=function(B){if(AJS.$(this).hasClass("disabled")){return }var C=GH.BacklogView.getRankableId(AJS.$(this));var E=GH.RapidBoard.State.getRapidViewId();var D=GH.BacklogStatistics.getNumIssuesInSprint(C);if(D<1){return }var A=GH.BacklogStatistics.getNumVisibleIssuesInSprint(C);var F=GH.SprintBacklogModel.getLastIssueKeyInSprint(C);GH.Dialogs.StartSprintDialog.showDialog(E,C,A)};GH.BacklogController.handleSprintStarted=function(){GH.BacklogSelectionController.clearSelection();GH.RapidBoard.ViewController.setMode("work");GH.RapidBoard.State.pushState()};GH.BacklogController.handleIssueForEpicCreated=function(A,B){if(!GH.BacklogController.visible){return }if(_.isUndefined(GH.BacklogController.handleIssueForEpicCreated.deferred)){GH.BacklogController.handleIssueForEpicCreated.deferred=new AJS.$.Deferred();setTimeout(function(){GH.BacklogController.loadData().then(function(){GH.BacklogController.handleIssueForEpicCreated.deferred.resolve();GH.BacklogController.handleIssueForEpicCreated.deferred=undefined},function(){GH.BacklogController.handleIssueForEpicCreated.deferred.reject()})},0)}return GH.BacklogController.handleIssueForEpicCreated.deferred};GH.BacklogController.registerIssueCreatedCallback=function(B,A){GH.BacklogController.issueCreatedCallbacks[B]=A};GH.BacklogController.unregisterIssueCreatedCallback=function(A){delete GH.BacklogController.issueCreatedCallbacks[A]};GH.BacklogController.handleIssueCreated=function(B,C){if(!GH.BacklogController.visible){return }var A=_.clone(GH.BacklogController.issueCreatedCallbacks);setTimeout(function(){GH.BacklogController.handleIssueCreatedImpl(C,A)},0)};GH.BacklogController.reloadAndShowCreatedEpics=function(A){GH.BacklogController.updateEpicData().done(function(){GH.BacklogController._showCreatedEpicsMessage(A)})};GH.BacklogController.handleIssueCreatedImpl=function(C,A){if(C.isSubtask){return GH.BacklogController.subtasksCreated(C)}function B(D){var E=_.map(D,function(G){return{issueKey:G.key,issueId:G.id,issueType:G.fields.issuetype.id}});var F=GH.EpicConfig.getEpicIssueTypeId();return _.reduce(E,function(H,G){if(G.issueType==F){H.epics.push(G)}else{H.issues.push(G)}return H},{issues:[],epics:[]})}return GH.BacklogController.getIssueDetails(C.issues,"issuetype").done(function(D){var E=B(D.issues);GH.BacklogController.issuesAndEpicsCreated(E.issues,E.epics,A)})};GH.BacklogController.getIssueDetails=function(C,A){var B=_.pluck(C,"issueKey");return GH.BacklogController.getIssueDetailsByKeys(B,A)};GH.BacklogController.getIssueDetailsByKeys=function(C,A){var D=C.join(",");var B="issueKey in ("+D+")";return GH.Ajax.get({url:GH.Ajax.buildBareRestUrl("/rest/api/2/search"),data:{jql:B,fields:A},jiraRestFormat:true},"getissues")};GH.BacklogController.issuesAndEpicsCreated=function(B,F,E){if(_.isEmpty(B)&&_.isEmpty(F)){return }if(_.isEmpty(B)){return GH.BacklogController.reloadAndShowCreatedEpics(F)}var C=_.map(E,function(G){if(_.isFunction(G)){return G(B,F)}return false});var D=_.filter(C,function(G){return G&&((G instanceof AJS.$.Deferred)||_.isFunction(G.promise))});var A=_.map(D,function(H){var G=new $.Deferred();if(H.always){H.always(G.resolve)}else{H.then(G.resolve,G.resolve)}return G});return AJS.$.when.apply(AJS.$,A).then(function(){GH.BacklogController.reloadAndSelectCreatedIssues(B)})};GH.BacklogController.subtasksCreated=function(A){GH.RapidBoard.QuickCreate.showSubtaskCreatedMessage(A);GH.PlanController.reloadDetailView(GH.DetailsView.TAB_SUBTASKS);return GH.BacklogController.loadData()};GH.BacklogController.reloadAndSelectCreatedIssues=function(A){return GH.BacklogController.loadData().done(function(){var B=_.last(A);var C=GH.BacklogModel.isIssueVisible(B.issueKey);if(C){GH.BacklogSelectionController.selectIssue(B.issueKey)}else{GH.RapidBoard.QuickCreate.showCreatedIssuesMessage({issues:A})}})};GH.BacklogController._showCreatedEpicsMessage=function(D){var C=_.last(D);var B=GH.BacklogModel.getIssueListForEpics();var A=B.isIssueVisible(C.issueKey);GH.RapidBoard.QuickCreate.showCreatedEpicsMessage({issues:D},A);if(A){GH.EpicView.scrollToBottom()}};GH.BacklogController.handleSprintUpdated=function(B,A){GH.BacklogController.updateOpenSprint(A.id,false)};GH.BacklogController.handleIssueUpdated=function(C,F){if(!GH.BacklogController.visible){return }GH.log(C.type+" from source "+F.source+" handled","BacklogController");var I=parseInt(F.issueId,10);var E=GH.BacklogModel.findListWithIssues(I),H=false,B=false,A=false,K=false,G=false,J=false,D;if(F.source==="quickEdit"){H=true;if(GH.BacklogModel.isSprintIssueList(E)){B=true;A=GH.BacklogModel.getSprintIdForSprintIssueList(E)}else{if(GH.BacklogModel.isEpicIssueList(E)){G=true}else{K=true}}if(E){D=E.getIssueDataForId(I);if(D&&D.epic){G=true}}if(!E&&GH.BacklogModel.trackingStatistic.isEnabled){J=true}}else{K=true;if(F.fieldId===GH.BacklogController.rapidViewConfig.estimationStatistic.fieldId){if(E){D=E.getIssueDataForId(I);if(D&&D.epic){G=true}}}}if(B){GH.BacklogController.updateOpenSprint(A)}else{if(K){GH.BacklogController.reloadSingleIssue(F.issueId)}}if(H&&!J){GH.PlanController.reloadDetailView()}if(G&&!J){GH.BacklogController.updateEpicData()}if(J){GH.BacklogController.loadData()}};GH.BacklogController.handleIssuesRemovedFromSprint=function(A,B){if(!GH.BacklogController.visible){return }GH.BacklogController.loadData()};GH.BacklogController.removeIssues=function(B){var D=GH.BacklogModel.findListWithIssues(B);var C=GH.BacklogSelectionController.getSelectedIssueKey();var A=_.contains(B,C);D.removeIssues(B);GH.BacklogSelectionController.selectionManager.removeSelectedIssueKeys(B);if(GH.BacklogModel.isBacklogIssueList(D)){GH.BacklogView.updateAllMarkers()}};GH.BacklogController.isFiltersActive=function(){return !_.isEmpty(GH.PlanControls.quickfilters.getActiveQuickFilters())};GH.BacklogController.executeSearch=function(B){GH.Logger.timeStart("GH.BacklogController.executeSearch regex");if(_.isNull(B)){GH.BacklogController.lastExecutedSearchFilter=null}else{var A=" ";GH.BacklogController.lastExecutedSearchFilter=function(D){return B.test(D.key+A+D.summary+A+D.typeName)}}var C=GH.BacklogModel.setInstantFilter(GH.BacklogController.lastExecutedSearchFilter);GH.Logger.timeStop("GH.BacklogController.executeSearch regex");GH.Logger.timeStart("GH.BacklogController.executeSearch ui update");if(C){GH.BacklogView.updateHiddenIssues()}GH.Logger.timeStop("GH.BacklogController.executeSearch ui update");return false};GH.BacklogController.clearFilters=function(){var A=GH.PlanControls.quickfilters.clearFilters();GH.PlanControls.searchFilter.clearSearchBox();GH.EpicController.setFilteredEpicKey(null);if(A){GH.BacklogModel.clearFilters();GH.BacklogController.loadData().done(function(){GH.RapidBoard.State.pushState()})}else{var B=GH.BacklogModel.clearFilters();if(B){GH.EpicView.deselectAllEpics();GH.BacklogView.updateHiddenIssues();GH.RapidBoard.State.pushState()}}};GH.BacklogController.updateEpicFiltering=function(A,B){var C=GH.BacklogModel.setEpicFilter(A);if(C&&!B){GH.BacklogView.updateHiddenIssues()}};GH.BacklogController.calculateIssueRenderData=function(){var B=GH.BacklogSelectionController.getSelectedIssueKeys();var C={};_.each(B,function(E){C[E]=true});var A=GH.BacklogSelectionController.getSelectedIssueKey();var D=GH.BacklogModel.getHiddenBySearchIssues();return{selectedIssueKeys:C,mainSelectedIssue:A,hiddenIssues:D}};

The issue is eventually created, but the users think not because of this error, plus they don't see immediately the created Issue number.

When we choose to create issue from the dashboard, it works, so I just presume it might have something to do with the GreenHopper or so.

Any ideas? Many thanks!

1 answer

1 accepted

0 votes
Answer accepted
Theinvisibleman
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 26, 2013

Hi Loredana,

I suspect that you are facing this bug - https://jira.atlassian.com/browse/GHS-7317. May I know if you have disabled the feedback module? That usually triggers this bug.

Not to worry, though, as the bug has been fixed in GreenHopper 6.1.3.2, as stated in the bug report :)

Cheers,

Joe

Loredana February 28, 2013

Thx, we will try the GreenHopper Update. We didn't disable any module.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events