AnsweredAssumed Answered

record.js creates javascript error if not logged in as admin

Question asked by Mike Solomon on Jul 1, 2014
Latest reply on Jul 2, 2014 by Mike Solomon
I have created a file custom/modules/Accounts/clients/base/views/record.js

If I am logged in as admin my code works properly but if I try it as another user I get a fatal javascript error

FATAL[2014-7-1 16:7:25]: Uncaught SyntaxError: Unexpected token < at https://mydomain/sugar/dev721/sidecar/lib/jquery/jquery.min.js  on line 4

logger.js:122
Uncaught SyntaxError: Unexpected token <

The code that is causing this is the following

this.sql = "SELECT COUNT(*) AS CNT FROM accounts WHERE DELETED = FALSE AND homecompany = TRUE";

 this.data = this.GetDataAjax(this.sql);

 GetDataAjax: function (sql) {
        //pass sql to ajax.php & return data
         var url = "index.php?entryPoint=ajax&sql=" + sql;
     var data;
     
     $.ajax({
            url : url,
            async : false,
            success:function(json) {
                data = $.parseJSON(json);
            }
        });
    
     return data;
    },


Why would it work properly as admin but break for all other users?

Why is the javascript error showing as in https://mydomain/sugar/dev721/sidecar/lib/jquery/jquery.min.js not in record.js?

Any idea how I can make this work?

My usual comment it all worked properly in 6.5







Outcomes