In the latest patches to SugarCRM version 7, you may have run into a "Data not available" error immediately after installing a module or while trying to go to your new module's end points using the Sugar App router. You may have found out that by simply refreshing the page and going back to your endpoint solves the issue. I knew there had to be something Sugar was doing on a page refresh that it wasn't doing after a module was installed.

After browsing through the many AJAX requests of Sugar 7, I found a "sync" request that loads a lot of information Sugar needs to operate, including all the available routes for your modules. Since Sugar 7 is a one-page application (meaning it uses AJAX requests for everything), after a module finishes installing through the module loader, the browser is not aware of the new routes your newly installed module added which is why the "Data not available" error is shown. Simply running a sync will solve this.

It's as simple as the script above. Once that runs, your app will know about your new routes.

One important thing to note is the callback option for the sync method. Since Javascript is the asynchronous language that it is, the sync method lets you define a javascript method to be run once the sync completes. In our post_install.php scripts, we echo out something like the code below. It will initiate the sync and once it finishes it will redirect to your license validation page. This makes the module installation progress seamless for the user.