How can we Repair and Rebuild when creating a record through a custom hook file after save functionality? Note:- It saves records when we need them not regularly.

Hello all,

I'm wondering if there is a way to trigger Repair and Rebuild automatically when creating records via hooks after saving. I have a custom module where I create records, and I'm currently updating the JS file manually after creating each record to trigger Repair and Rebuild. Rather than having to go through the admin section to trigger Repair and Rebuild each time, I'd like to automatically run Repair and Rebuild as part of the record creation process.

Does anyone know if it's possible to automatically trigger Repair and Rebuild from a hook after saving a new record? Any pointers on how I could implement this would be greatly appreciated!

Thank you!

Parents Reply Children
  •  Hi  ,

    Your JS would probably have some sort of hardcoded values based on this record creation right? You should make it dynamic and extract that data through our API endpoints just like the whole Sugar codebase, that's the way to go, running QRR is not.

    You modify your JS file to make an AJAX call to the server and pull out all the data you need like so:

    var url = app.api.buildURL('Accounts/' + <ANY FILTER>, null, null);
    app.api.call('read', url, null, {
        success: _.bind(this.myMethodThatPopulatesDropdownValues, this),
        error: function() {
            app.logger.error('Something bad happend, gotta retry');
        }
    });

    SugarCRM | Principal Developer Advocate