Below, you can see the output from these two logs. The first clearly shows the full object with the property I\'m trying to access, but on the very next line of code, I can\
I had similar problem (when developing for SugarCRM), where I start with:
var leadBean = app.data.createBean('Leads', {id: this.model.attributes.parent_id});
// This should load object with attributes
leadBean.fetch();
// Here were my attributes filled in with proper values including name
console.log(leadBean);
// Printed "undefined"
console.log(leadBean.attributes.name);
Problem was in fetch()
, its async call so I had to rewrite my code into:
var leadBean = app.data.createBean('Leads', {id: this.model.attributes.parent_id});
// This should load object with attributes
leadBean.fetch({
success: function (lead) {
// Printed my value correctly
console.log(lead.attributes.name);
}
});