AnsweredAssumed Answered

record.js - addValidationTask - fetch data

Question asked by swaldinger on Jan 23, 2019
Latest reply on Jan 23, 2019 by André Lopes

Hi all,

 

I added a validation task on a record.js file (addValidationTask from https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_8.0/Cookbook/Adding_Field_Validation_to… ) 

 

This function performs some checks after clicking the save button and also modifies some other data of the record (which were not touched by the user). This works fine.

After saving, the record data get reloaded once, so that the data which were modified by the validation function are shown.

After another second change on this page, it still shows the old data of the first change.

If I reload the page manually the new correct data of the second change are shown.

 

I found a function this.model.fetch() which can reload the record data, but don't know how to use it.

 

Can someone help me how to use it, e.g. like this, but the event doesn't exist:

this.model.on('data:saved:success', function () {
    this.model.fetch();
}, this);

 

 

Many Thanks

 

 

PS: Sugar Version 8.0.1

Outcomes