AnsweredAssumed Answered

Synchronization issue while saving a record with file.

Question asked by Surabhil Sergy on Feb 19, 2016

I have a custom module with a file upload option.When creating a record -uploading process is completed only after the file is saved.

While checking the create.js , I could see :


saveModel: function (success, error) {

        var self = this,


        success = _.wrap(success, function (func, model) {

            app.file.checkFileFieldsAndProcessUpload(self, {

                    success: function () {




                {deleteIfFails: true}



        options = {

            success: success,

            error: error,

            viewed: true,

            relate: ( ? true : null,

            //Show alerts for this request

            showAlerts: {

                'process': true,

                'success': false,

                'error': false //error callback implements its own error handler


            lastSaveAction: this.context.lastSaveAction





        options = _.extend({}, options, self.getCustomSaveOptions(options));, options);



Here the function checkFileFieldsAndProcessUpload is completed only after the .

I need to get the file (named with record id) to be processed on after_save logic hook. But on creation this after save logic doesn't get the file uploaded to process and is not working as expected. The file is getting uploaded but the process is not synchronized.


Even with default 'Notes' module, I could see that the file saves after the record is saved. The notification toaster shows - 'uploading' and 'saving' process in unusual order.


With edit view there is no synchronization issue and the code snippet in record.js (record view) is different .


How can I override this issue to get the after_save logic hook working? Please advise.