AnsweredAssumed Answered

SugarCRM 7.9 ENT - Data not available after refresh or redirect problem

Question asked by Nazar Lobay on Feb 19, 2018

I've created installable package for my Sugar'plugin'. It creates simple custom layout like this:

mylayout.php

$viewdefs['base']['layout']['mylayout'] = ['type' => 'simple','components' => [    [        'view' => 'mylayout',         'primary' => true    ],]];

mylayout.hbs

 

<!DOCTYPE html><html><head>    <meta charset=utf-8>    <meta name=viewport content="width=device-width,initial-scale=1">    <title>Sugar App</title>    <link href=include/assets/css/app-sugar.css rel=stylesheet></head><body><div id=sugar-app></div><script>baseURL = App.api.serverUrl + "/app";</script><script type=text/javascript src=include/assets/js/manifest.js></script><script type=text/javascript src=include/assets/js/vendor.js></script><script type=text/javascript src=include/assets/js/app.js></script></body></html>

where I render my views created in VUE.js (registration,login,settings,account pages to integrate with my website) . Then I've added profile action link which redirects to my layout - http://localhost/sugar_7/#Home/layout/mylayout. When redirected to my layout I'm getting http://localhost/sugar_7/#/create (or /login, /settings etc...) url - it works with my custom endpoints sugar_7/rest/v10/app/{endpoint}.

Everything seems to be fine, routing inside my layout works, data is passed, custom rest-api works just fine, but... when I try to refresh the page while on my views page I'm getting:

Data not available Page does not exist or you do not have permission to access this page. Please try again. If the error persists, please contact your Sugar Administrator. Go back to previous page.

and I'm stuck on http://localhost/sugar_7/#/create url no matter what other SugarCRM link I click, the only solution then is to type url to the main page manually http://localhost/sugar_7. I've noticed the same behavior when I go to my custom layout page, then go to Contacts or Accounts or whatever, then go again on my layout page - after the second visit I'm stuck on http://localhost/sugar_7/#/create again with Data not available page, no matter what link I would click.

Could it be conflict between backbone.js and vue.js routing?

Outcomes