AnsweredAssumed Answered

question on dashlet layout in v7

Question asked by Francesca Shiekh on Jan 22, 2015
Latest reply on Jan 23, 2015 by Francesca Shiekh
I have a custom dashlet that retrieves deleted records from a custom module role_Contact_Roles related to Contacts and Accounts to be displayed in the intelligence pane of the Contact/Account.
  
The code below works and pulls the correct data, I just need the last step to display it.
I am being lazy and want to save myself the trouble of adding filters to the API and building an hbs for it, rather I just want to say: use the layout that you would if it was a list view dashlet.
               
({
  className: 'dashlet-contactRoleHistory',
  plugins: ['Dashlet'],
  initDashlet: function() {},
  resources: {},
  loadData: function (options) {
    if(_.isUndefined(this.model)){
      return;
    }
    var id = this.model.get('id'),
        module = this.module;
    if (_.isEmpty(id) || _.isEmpty(module)) {
      return;
    }
    if(module == 'Contacts'){
      rel_name = 'role_contacroles_contacts';
    }else if(module == 'Accounts'){
       rel_name = 'role_contacroles_accounts';
    }
    var self = this;
      url = app.api.buildURL(module+'/'+id+'/link/'+rel_name+'?[filter][0]deleted=1');
    app.api.call('GET', url, '', {
      success: _.bind(function (data){
        self.data = data.records;
        self._super('render');
      }, this),
      error: _.bind(function(o){
        console.log('Error Getting Deleted Contact Roles: ' +o);
      }, this),
    });
  } ,
})
                                                             


thanks,

FrancescaS

Outcomes