AnsweredAssumed Answered

Module cancelClicked event running through before API calls completed.

Question asked by danielw on Feb 8, 2016
Latest reply on Mar 9, 2016 by danielw

Hi there,


I'm refactoring a custom 'Multiple Attachments' field type.


The user uploads files, via AJAX request to an API endpoint, while record is in 'edit' action.

On 'cancel' ('cancelClicked' in 'record.js'), I need to remove those uploaded files again, but the 'cancel' event is running through before I get a chance to delete them all (also via AJAX request to API endpoint).

Specifying synchronous AJAX requests doesn't help.


It works fine when deleting files that have already been uploaded on 'Save', since I can tie into the 'before_save' logic hook, but there isn't an equivalent mechanism for 'cancel'.


I'm still a bit new to SugarCRM, so may be missing something glaringly obvious.


You help will be greatly appreciated.