Polys Kasinides

Set value on field causes the record to be indicated as changed and not saved

Discussion created by Polys Kasinides on Jun 21, 2016
Latest reply on Jun 28, 2016 by Matt Marum

Hi all,

 

We have an issue with some functionality we did and cannot figure out a workaround.

As you will see in the below code snippet, we set up a function to be executed on sync event.

In turn this function sets the value of a field on the model.

Since we did this we have the issue that when a user of the CRM clicks to view a record and then clicks anywhere else to visit another part of the CRM the system informs the user that the record is changed and to confirm that they want to leave the page.

We figured out that this has to do with the set function.

 

How can we do this differently or work around this issue?

 

 

record.js

({

    extendsFrom: 'RecordView',

    initialize: function (options) {

        this._super('initialize', [options]);

        this.model.on("sync", this.someFunction, this);

 

},

someFunction: function() {

     this.model.set('field_name', value);

},

})

Outcomes