Total not refreshing on Report based Dashlet (running 7.6.1 Pro)

I have some dashlets based on reports. In the title appears the total.
Each time you re-run the report the total updates but when the dashlet refreshes the title remains the same as when the report-dashlet was first added and totals don't update.

How can I get the total to refresh?
  • This sounds like a bug we saw not long ago. Let me look into it and I'll report back.
  • Does this sound like the issue you are experiencing? 

    ===========
    Dashlets for charts driven by reports do not automatically refresh "Title" totals.

    1. Create a report that summarizes data, such as opportunities, and include a chart
    2. Display report's chart in a Dashlet
    3. Enable the "Show Title" checkbox
    4. Click button to save chart settings and display dashlet

    Result:

    The title on the chart will show the text in the field next to the "show title" field, but the associated total value will not refresh or update accordingly to reflect the data in the report.

  • yes it does. It was working in 7.5.1 but broke with 7.6.1
  • Hmm...

    Its marked as fixed in 7.7 in our system, but based on my info, it is not clear whether it worked in 7.5.1. It states that it was found in 7.2.1, but not whether it also existing in versions in between.

    Let me look into it some more.
  • Thanks, it's pretty crucial for our managers and I would be ok with a patch or a temporary code-based-fix if I can give them back the proper functionality.
    (Managers claimed it worked before Friday's upgrade from 7.5.1 to 7.6.1)
  • I will look into it for you and reply with my findings. Sorry for the inconvenience.
  • Angel, I tracked it down to 
           

    clients/base/views/saved-reports-chart]$ vi saved-reports-chart.js 

    and fixed it (non-upgrade safe of course)

    in setChartParams the title is not updated when the page is loaded the update flag is not set so it uses the _.defaults to set the additional parameters but the title is already set, so it's not updated.

    See bold below:

           
           

        setChartParams: function(serverData, update) {

            // only called by bindDataChange when the report id is changed in config panel

            if (!serverData.reportData || !serverData.chartData) {

                if (!this.meta.config && this.chartField) {

                    this.chartField.displayNoData(true);

                }

                return;

            }

            update = _.isUndefined(update) ? false : update;


            var data = serverData.reportData,

                properties = serverData.chartData.properties[0],

                params = this.getDefaultSettings(),

                barType = this._getBarType(properties.type),

                defaults = {

                    label: data.name,

                    chart_type: properties.type,

                    report_title: properties.title,

                    show_legend: properties.legend === 'on' ? true : false,

                    stacked: barType === 'stacked' || barType === 'basic' ? true : false,

                    x_axis_label: this._getXaxisLabel(data),

                    y_axis_label: this._getYaxisLabel(data)

                };

    // defaults has the correct title with the right total

            // override settings when new report is selected

            if (update) {

                _.extend(params, defaults);

            } else {

                _.defaults(params, defaults);

    // the next line is added by me :) and updates the total on the chart

    params.report_title = defaults.report_title;

            

            }

    // the params don't have the updated title unless I set it

            // persist the chart settings for use by SugarCharts

            this.reportData.set({

                rawChartParams: params

            });


            // update the settings model for use by chart field

            this.settings.set(params);


            // toggle display of chart display option controls based on chart type

            this._toggleChartFields();


            // set the title of the dashlet to the report title

            this.$('[name="label"]').val(this.settings.get('label'));

        },


    HTH

    FrancescaS

  • Very cool. 

    You should be able to do that in an upgrade-safe manner by extending that controller. Put your code in ./custom/clients/base/views/saved-reports-chart/ and in saved-reports-chart.js do:

    ({
    extendsFrom: 'SavedReportsChartView',

    setChartParams: function(serverData, update) {
    //your version of the method

    }

    })

  • Thanks! I'm not a big fan of replacing methods, but this will work until a fix is available.