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

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
Parents
  • Sidecar will save entire bean by default and our REST APIs do not support PATCH methods. But Sidecar also supports optimistic record locking.

    bean.save({industry:'value'}, {lastModified: bean.get('date_modified')});

    If the last known modified time for a Sidecar bean is older than the current modified time on the server, then this request will fail with a 409 response and a save will not be processed.

    If you make multiple changes in different tabs on Record views for a single record then Sidecar UI will display a "Merge Conflicts" drawer that will allow an end user to manage the conflicting changes.

    I think the best practice is to try and avoid situations where multiple users are trying to modify same record at same time. This is always a challenging situation to manage from a user experience perspective. If you anticipate conflicts on certain records, then I'd reconsider your data model or I'd recommend allowing only allow the assigned user to change them. This can be configured in Role Management.

    App Ecosystem @ SugarCRM

  • In the general case, Sugar cannot make 100% accurate automatic decisions about how to merge conflicting record changes. The damage that could be done to customer data if you get something like that wrong is huge.

    You may be able to for your specific use case, which is great and could be a worthwhile customization for your specific use case.

    Adding PATCH support is not on the radar. You should file an enhancement request to make sure it's tracked.

    App Ecosystem @ SugarCRM

Reply
  • In the general case, Sugar cannot make 100% accurate automatic decisions about how to merge conflicting record changes. The damage that could be done to customer data if you get something like that wrong is huge.

    You may be able to for your specific use case, which is great and could be a worthwhile customization for your specific use case.

    Adding PATCH support is not on the radar. You should file an enhancement request to make sure it's tracked.

    App Ecosystem @ SugarCRM

Children
No Data