AnsweredAssumed Answered

Developer guide custom routes example not working, cannot find cause

Question asked by Artis Plocins on Mar 17, 2017
Latest reply on Apr 25, 2018 by Haseeb Jehanzeb

I have installed a fresh instance of SugarCRM 7.8.1.0 Enterprise on a SugarCRM 7 ready configuration of Ubuntu with Vagrant and Packer.

 

Going through the Developer guide for SugarCRM 7.8 I got to the Routes example and could not get it to work even when copied precisely and cleared the cache directory, Quick Repair & Rebuild, Repair JSGroupings and clearing the browser cache.

Here are the errors I get:

2017-03-17_1148 

 

They really don't help at all, it appears that it's reading the entire page as each of those JS files, so the unexpected token '<' is the first symbol in '<!DOCTYPE HTML> on the second line.

 

 

Other than this issue, do you know what could cause the ./cache/include/javascript/sugar_grp7.min.js file to be generated and regenerated without the .min part? I made a new instance because I could find what's causing that. But the most important issue for me now is that custom route example above, so please advise.

 

Edit:

I found out that all routes start with the hashtag because of the comment in the route() example, so I think I should access my custom routes like #test/doSomething, but I still get errors, though different now: https://screencast.com/t/WRSzKO1gthxK

 

Edit2:

I got the example routes to work, but not the single route() function example above the multi-route one.

This is the code I added to my customRoutes.js file below the multi-route example and it is not working at all:

(function(app){
  app.events.on('router:init', function() {
    // Register the route #test/123
    app.router.route('testroute/:id/:id2', 'testroute', function() {
      console.log(arguments);
      app.controller.loadView({
        layout: 'custom_layout',
        create: true
      });
    });
  });
})(SUGAR.App)

Outcomes