AnsweredAssumed Answered

Open a selection-list with a filter from another module

Question asked by Kenneth Brill on Jun 2, 2018
Latest reply on Jun 4, 2018 by Kenneth Brill

OK,   So I am in Contacts and I have a menu option that opens a selection-list that shows all 'Customers' (a custom module) related to this Contacts related Account. 

So first I have to get the related account (we are not using the stock accounts relationship anymore, not sure why, before my time).  Then I feed that to the open_drawer with the related filter but nothing ever comes up.  The code looks like this

 

 

find_customers: function () {
          var contactBean = app.data.createBean('Contacts', {id: this.model.get('id')});
          var related_collection = contactBean.getRelatedCollection('accounts_contacts_1');
          related_collection.fetch(
               {
                    relate: true,
                    success: _.bind(function (attributeData) {
                         var account = attributeData.models;
                         var accountID = account[0].get('id');
                         var accountBean = app.data.createBean('Accounts', {id: accountID});
                         var context = {
                              recParentModel: accountBean,
                              module: 'IN_Customers',
                              link: 'accounts_in_customers_1',
                         };
                         app.drawer.open(
                              {
                                   layout: 'selection-list',
                                   context: context,
                              }, _.bind(this.getTemplateInfo, this));
                    }, this),
                    fields: ['id', 'name'],
               });
     },

I get the AccountID and the AccountBean but I cant figure out how to feed that to the drawer.open function.  Can anyone help?

Outcomes