AnsweredAssumed Answered

Saving backbone model does not update model id

Question asked by Ivica Nedeljkovic on Jul 20, 2016
Latest reply on Jul 26, 2016 by Tevfik Tümer

I am using version 7.7 of SugarCRM, and have javascript code

 

var contactModel = app.data.createBean('Contacts', contact); // contact variable contain correct object

var response = contactModel.save();

console.log(contactModel); // correct contactModel and contactModel.id value

console.log(contactModel.get("first_name")); // log correct value

console.log(contactModel.get("id")); // log undefined

 

The problem is that contactModel contain correct value for id when I check it in browser developer tools, however when I try to get contactModel.id it is undefined which doesn't have sense.

So is there some additional parameter that I should pass to save method, or am I doing something wrong?

Outcomes