Get data from a Drawer

If I have something like this in my record.js, the module is Notes

app.drawer.open({
     layout: 'create',
     context: {
          create: true,
          module: linkModule,
          recParentModel: parentModel,
          model: prefill,
          recLink: link,
          recContext: this.context,
          recView: this.view
                              }
     }, _.bind(function (model) {
          //get data from model here
        }

is there a way to get the savd note ID and DESCRIPTION from 'model'?  I have tried everything I know and I cant seem to get back to the record that was created from the opened drawer.

Parents
  • Hi Kenneth Brill,

    I tried your code and it worked for me. Hope, you are using 'this' with the _.bind function like:

    _.bind(function (model) {
          //get data from model here
          console.log('my notes model: ',model);

    }, this));

    You can even use it without the bind function.

    Also, please try printing console.log(model) and verify the value you are getting in model variable.

    Regards.

  • I figured it out

    app.drawer.open(
    {
         layout: 'create',
         context: {
              create: true,
              module: linkModule,
              recParentModel: parentModel,
                 model: prefill,
              recLink: link,
              recContext: this.context,
              recView: this.view
         }
    }, _.bind(function (context, newModel) {
         console.log(newModel.get('id'));
         console.log(newModel.get('description'));
    }}, this);

    I did that by hand so I might not have the right number of braces but you get the jist.

Reply
  • I figured it out

    app.drawer.open(
    {
         layout: 'create',
         context: {
              create: true,
              module: linkModule,
              recParentModel: parentModel,
                 model: prefill,
              recLink: link,
              recContext: this.context,
              recView: this.view
         }
    }, _.bind(function (context, newModel) {
         console.log(newModel.get('id'));
         console.log(newModel.get('description'));
    }}, this);

    I did that by hand so I might not have the right number of braces but you get the jist.

Children
No Data