this.context undefined

Hi.

I'm working on a customization of the recordlist.js

I have the following code /custom/modules/Contacts/clients/base/view/record/recordlist.js:

extendsFrom: 'RecordlistView',
          initialize: function(options) {
               este = this;
               var self = this;
               this._super("initialize", [options]);
               if (this.layout) {
                    this.layout.on('list:unificar:fire',this.unificar,this); 
               } 
          },
          popup_unificar: function(band,id,pidm0,pidm1){  
               var self = this;
               if(band == 2 && pidm0!=pidm1){//Si los 2 registros tienen PIDM y son diferentes pidm
                    app.alert.show('message-id', {
                         title: 'ERROR: ',
                         level: 'error',
                         messages: 'No es posible realizar la unificación debido a que son personas creadas en Banner, si considera necesario, debe reportar el caso para realizar unificación desde Banner.',
                         autoClose: false
                    });
                    console.log("Cargando datos de nuevo1");
                    self.layout.context.reloadData({
                         showAlerts: false
                    });
                    console.log("NOOOO sacar popup");
               }
               else{
                    if (!_.isEmpty(id)) {
                         if(   this.context.get('mass_collection').models[1].id== id.get("id")  ) {
                              var aux = this.context.get('mass_collection').models[0];
                              this.context.get('mass_collection').models[0] = this.context.get('mass_collection').models[1];
                              this.context.get('mass_collection').models[1] = aux;
                         }
                    }
                    this.mergeDuplicates(this.context.get('mass_collection'));//Generar Popup de Unificación nativo            
               }
               console.log(band + " popup_unificar");  
          },
          unificar: function(){  
               //miVariable = miVariable2.context.get('mass_collection');
               console.log("Si funciona");
               this.collection.fetch();
               var registro2 =     this.context.get('mass_collection');
               var self = this;
               var band = 0;
               var registros = $(registro2.models);
               console.log("unificando " + registros.length + " registros");
               if(registros.length != 2){
                    app.alert.show('errorNumeroPersonas', {
                         level: 'error',
                         messages: 'Debe seleccionar solo dos registros, ha seleccionado '+registros.length,
                         autoClose: false
                    });
                    console.log("Cargando datos de nuevo2");
                    self.layout.context.reloadData({
                         showAlerts: false
                    });
               }
               else{
                    var id_pidm = null;
                    var pidm0 = "";
                    var pidm1 = "";
                    var band = 0;
                    registros.each(function(i, record){
                         var principal;
                         var userBean = app.data.createBean('Contacts', {id: record.id});
                         var request = userBean.fetch();
                         request.xhr.done(function () {   
                              pidm = userBean.get('pidm_c');
                              if(pidm != null && pidm.length != 0  && pidm != ""){
                                   id_pidm = userBean;
                                   band++;
                              }                           
                              if(i==0){
                                   pidm0 = pidm;
                              }
                              else if(i==1){  
                                   pidm1 = pidm;
                                   self.popup_unificar(band,id_pidm,pidm0,pidm1);
                              }
                         });
                    });
               }
          },

Sometimes context returns as undefined and does not execute the mergeduplicate process

this.context.get("mass_collection") is undefined

The version we are working on is 7.9.4 Professional. 

I would like to know if you have any comments on this.