Monday, April 14, 2014

The Issue of Legibility

Those of you that have been working with Sugar 7 have likely already noted that much of the JavaScript code utilized is minified. While that is a nifty trick to squeeze out some more performance, it makes code very difficult to read, such as the snippet inserted below:

({inlineEditMode:false,createMode:false,plugins:['SugarLogic','ErrorDecoration','GridBuilder','Editable','Audit','FindDuplicates','ToggleMoreLess'],enableHeaderButtons:true,enableHeaderPane:true,events:{'click .record-edit-link-wrapper':'handleEdit','click a[name=cancel_button]':'cancelClicked','click [data-action=scroll]':'paginateRecord','click .record-panel-header':'togglePanel','click .tab a':'setActiveTab'},buttons:null...

From the standpoint of a consultant, and one in charge of applying code level modifications to a given Sugar instance, having to unravel code like this in order to work on a customization is a bit of a nightmare. One is also put in a situation in which one has to rely on the use of JavaScript beautifiers and similar tools to display the code in a more legible manner. 

No need to worry, however. Legible versions of the JavaScript code that Sugar utilizes and in turn, minifies, are easily accessible, thus simplifying our work. The table below gives us a listing of the various file locations that might be of interest to developers:

Minified Files
Un-minified Source

In future posts we will take a closer look at other aspects of the file system that are equally important.

Have fun exploring!

Tuesday, April 1, 2014

SugarCRM Cookbook: Retrieving User Roles

One of the challenges relating to the adoption of any new technology is understanding the manner in which one accomplishes equivalent tasks based on our experience with previous versions of the same technology. Sugar 7 is no exception to this rule, and this challenge is perhaps its biggest within the development community.

With that in mind, lets talk about a recent situation I came across that very much speaks to this point. In short, in the course of talking about the 7.x technology, the question arose of how one would go about retrieving a list of Roles assigned to a given user. Because we have to do this through a JavaScript based controller, techniques we might have used in the past are no longer applicable.

For the purposes of our example we will assume that we wish to retrieve the list of Roles assigned to the currently logged in user, in turn allowing us to see some details about the manner in which we interact with the current user, also a common need and one that also differs greatly. 

The following Gist will allow us to retrieve the Roles:

NOTE: Roles are only accessible to Admin level users and as such, the above code would only function if executed by a user with Admin privileges. In turn, it would also be best to specify a particular user ID rather than relying on the current user. 

Thursday, February 13, 2014

SugarCRM Troubleshooting: SugarCRM 7 Installs

Wow! - That was my initial reaction when I first saw early versions of SugarCRM 7.0 (Sugar 7) a little over a year ago. It reminded me of how impressed I was the first time I saw Sugar in its 3.0 days.

Fast forward to today and a lot of folks have had a chance to experience the same. New customers utilizing the SugarCRM OnDemand environment have had access to 7.0 for a few months. More recently, new on-premise customers utilizing classic LAMP stacks have also been able to take advantage of all the great new features in 7.0. 

As the with any new software release, as it gets exposed to greater quantity of users, certain patterns emerge relating to common problems users encounter. Sugar 7 is no exception. 

Perhaps the most common issue in the 7.0 world today is one where the install procedure completes without error, but after completion, the Sugar login page never displays. In its place, users will see the following:

It would seem Sugar never stops loading because the message never goes away. This is actually not far from the truth, but fortunately, there is a very simple fix to this problem. Before we look at the solution, it is worth briefly discussing the nature of the problem, as it is directly related to an important change that has been introduced into the Sugar architecture.