Javascript error "Cannot read property 'toString' of undefined" is thrown when accessing Control Chart report
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products will end after February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
When accessing the control chart report on the board, a javascript error is thrown.
The following appears in the browser:
Exception: Uncaught TypeError: Cannot read properties of undefined (reading 'toString')
Resource: http://localhost:42010/j82010/s/7d26c5885d31b8991f753c445f153fb4-CDN/pxfuiz/820010/1dlckms/cd8a9ac0970a299a4de45e330db511a2/_/download/contextbatch/js/gh-rapid-work,greenhopper-rapid-non-gadget,jira.project.sidebar,jira.global,atl.general,com.atlassian.jira.projects.sidebar.init,-_super/batch.js?agile_global_admin_condition=true&baseurl-check-resources=true&flexboards=true&healthcheck-resources=true&jag=true&jaguser=true&locale=en-AU&whisper-enabled=true
Line: 8673
Column: 1953
Notice that it mentions Line: 8673 and Column: 1953. This is the line to focus on.
Diagnosis
Diagnostic Steps
In the developer tool (under the Source or Debugger tab), we'll see the related line (in this case line 8673 - 1) refers to this module:
/* module-key = 'com.pyxis.greenhopper.jira:jira-agile-control-chart', location = 'includes/js/rapid/ui/chart/v2/controlchart/ControlChartRefinementsView.js' */
We can add the breakpoint on line 8673 as this is the line number stated in the Javascript error.
As we expand this minified line, we'll see it's referring to e = t.multiSelect.model.getDescriptor(e.toString()) from this function
function e(t, e) {
if (t) {
t.multiSelect.clear();
a.each(e, function(e) {
e = t.multiSelect.model.getDescriptor(e.toString());
t.multiSelect.selectItem(e, !0)
});
Refreshing the page will pause at the breakpoint and we'll see it indicates e = undefined
Using the developer tool of the Firefox browser, we could see t is referring to the Columns button (the drop-down menu on the control chart report).
And that there is no defined value for this Columns drop down
Cause
On the board configuration > Column management page, there are no statuses being mapped to any of the columns.
Resolution
Map at least one status to one of the columns.