AnsweredAssumed Answered

model.save() over write the full bean instead of just set fields

Question asked by Prashant Patel on Mar 13, 2018
Latest reply on Mar 20, 2018 by Prashant Patel

Hello Folks,

 

I have find out a big problem with sugarcrm.

 

I have created the custom popup for Accounts module by following Adding a new popup view in Sugar 7.x Record View « Sugar Developer Blog – SugarCRM  and it is working fine.

 

Now Suppose I have Industry field on the model popup. So I have used the code

this.model.set('industry'.'value');
this.model.save();


and industry field is updated with the value that I have been set on the model.
BUT

if you open the model and then open the same record into next tab and change the Name field on the record to suppose 'XYZ' . Now go back to previous tab and apply the changes on the model to set the Industry field.

 

This should and suppose to just update Industry field but it update the name field with the previous one. It revert the name field as well.

 

This means this.model.save(); not just update the fields which we set using this.model.set(); it updates all the fields. full bean.

 

I have tried to save like below

 

this.model.save({industry:'value'});

but it is having the same effect. it update the full bean.

 

As of Backbone.js v0.9.9, you can simply pass { patch: true } to save().

I have tried the same but it seems like sugar has not implemented patch.

 

  • create → POST   /collection
  • read → GET   /collection[/id]
  • update → PUT   /collection/id
  • patch → PATCH   /collection/id
  • delete → DELETE   /collection/id
One record is updated by many users from different departments. And if any changes apply from the model popup and mean while the record has updated by some one then it over rite all the changes of the other users.

 

Can some one give some thoughts on this how to over come from this situation and what is sugarcrm guys answer on this?

 

Patrick McQueen Matt Marum Francesca Shiekh Alan Beam Hiren Darji

Outcomes