Force refresh on a record based on another session edit/save

We have a scenario which is presenting a data consistency challenge. A bit difficult to describe but the essence is as follows:

1) User 1 is in an Account record view working on a record

2) We have a custom module which is accessed by the same user and which updates some limited fields on the Account record they have open in 1)

3) In our custom module, we have the ability to action a 'save'  of the current record open in 1). This avoids the trigger of a 'Resolve Conflict' message when the user moves off or Saves their record (assuming no more changes after the 'save' from 2)

4) We also looked at 'updating' the limited fields so that the changes made by 2) were visible to the user session in 1) - however that results in the 'Refresh Conflict' UI message which causes user confusion and data inconsistency if the user chooses their data position as the conflict choice.

I think our issue is because the edit session in 1) is not fully reflecting the changes made by edits in session 2).

I appreciate that the native Sugar 'Resolve Conflict' is designed to handle conflict of 2 users genuinely editing the same record.

My question is:

Is there a method whereby in our custom module we can force a 'refresh' of the 'this' record which we are aware of in 1)

For example, some code we are using to force save of fields in session 2) on the 'current' record exposed in 1)

   if (this.model.module=="Accounts"  {
   this.model.save({account_type: '5'});

Is there some function we can use to force UI refresh of 1) from custom 2) session

These 2 sessions are associated with the same user name.

Thanks

Neil 

Parents
  • Unfortunatly you can't do this easily. One way this could be done is the following

    if you want to prevent data to be changed on an account when working on module b you could do the following. Suppose you have a logic hook that updates data from module b to the accounts.

    When user 1 opens the account a save is triggered to update a field on that record to value 1. 

    When user 2 changes the data in module b it checks if the field on the account is 1

    if so it adds a job to the queue to update.

    The job does the same thing. As long as account field = 1 add itself to the queue 

    else update account and remove itself from the queue.

    Something like this could work but just be aware that this can lead to very hard to debug behaviour    

  • Hi Jeroen Somhorst

    Thanks for your suggestion. I understand your thinking.

    When you say 'add job to queue', is the 'queue' part of standard Sugar process ? It's not something I'm familiar with.

    Neil

Reply Children