I must be missing something...
Why do on change events fire when the record view is loaded before that field is indeed changed?
How can I stop the execution of an on change until the field is actually changed?
thanks,
Francesca
if (!_.isEmpty(this.model) && this.model.hasChanged("<field_name>")) {...}
if(typeof this.model.get('<attr>') !== "undefined") { // function call }So, now we have hand full of options to try ;)
if(!_.isEmpty(this.model.get('contact_id_c')) && typeof(this.model.previous('contact_id_c'))!=='undefined' && !_.isEqual(this.model.get('contact_id_c'),this.model.previous('contact_id_c')))thank you everyone!
typeof(this.model.previous('contact_id_c'))!=='undefined'as sugar team is suggesting to make use of underscore functions as much as possible during customzation!