AnsweredAssumed Answered

Prevent this.model.set() to trigger "change" event

Question asked by Cristian Chavez on Jun 22, 2016
Latest reply on Jun 23, 2016 by Cristian Chavez

I have a custom record.js file where I'm catching the "change" event for a related field call "Product". When a user changes the Product field, I set other fields (amount, discount, etc) with values from the related record. In the same record.js , I use "this.model.set()" to set a value in the Product field if some condition is true. This action triggers the "change" event for Product field, wherewith the function that sets a value for amount, discount and other fields fires too. And that's wrong for our use case.

 

So, is there any way to differentiate between a change made by an user and by a development?. Said in other way, is there any way to prevent "this.model.set()" to trigger the "change" event?

 

Thanks!

Outcomes