How can I get the record ID from inside custom js?

Using sugar 7.6 on a BWC module.

Inside detailviewdefs.js, you can include javascript files using the 'includes' key.  How can I get the current record ID from inside my custom.js file?

Do I need to use

(function(app) {
//code here?
})(SUGAR.App);

or can I just use  SUGAR.App.something.... or is it app.something?

There is no documentation for the JS so i'm stuck.

Parents Reply
  • doesn't work. there is no record on field on the module. (I'm in the campaigns module).  I also want access the record ID from the backbone object and not the dom, 

    EDIT: It does get the ID from inside the JS file.  I was trying it in the console but that didn't work because BWC uses iframes.  This is the solution that I ended up using so i'm marking it as correct but i'm still wondering how to get the id using the backbone object

    app.controller.context.attributes.model returns the model object and I can see the ID in it but if I do app.controller.context.attributes.model.id or  app.controller.context.get('id') it always gives me undefined.

Children