Shad

Notifications Dashlet this.render()  fails

Discussion created by Shad on Jul 31, 2015
Latest reply on Sep 17, 2015 by Shad
I am using notifications for users for some of our workflow. It seems the notification count doesn't change value (and thus color) until the whole page refreshes. 

So I wanted to create a dashlet so users could auto refresh every minute.

I have the .php, .js, and .hbs files with the api call working okay so far but I am getting a console error when I call this.render on the api callback. Here is the my-notifications.js code I have.

I have been referencing these:
https://community.sugarcrm.com/thread/21331
https://community.sugarcrm.com/thread/18963
SugarCRM 7.x How to refresh a dashlet programmatically

Am I missing a reference or something? Sugar 7.6 Enterprise

The Chrome console error:

({
    plugins: ['Dashlet'],
            initDashlet: function(view) {
                if (this.meta.config) {
                    this.meta.panels=this.dashletConfig.dashlet_config_panels;
                } else {
                    var autoRefresh=this.settings.get('auto_refresh');
                    if (autoRefresh>0) {
                        if (this.timerId) {
                            clearTimeout(this.timerId);
                        }
                this._scheduleReload(autoRefresh*1000*60);}
                }
            },
            _scheduleReload:function(delay) {
                this.timerId=setTimeout(_.bind(function() {
                    this.context.resetLoadFlag();
                    this.loadData({
                        success:function() {
                            this._scheduleReload(delay);
                        }
                    });
                },this),delay);},
            loadData: function(options) {
                var user_id = app.user.id;
                //check if user_id is empty
                if (_.isEmpty(user_id)) {
                    return;
                }
                app.api.call('GET', app.api.buildURL('Notifications/'), null,{
                    success: function(data) {
                        console.log('raw= ' + data.records);
                        console.log('raw2= ' + data['records']);
                        this.notifications = data;
                        this.render();
                    }
                })
                console.log("user= " + user_id);
            }

        })

Outcomes