SugarCRM Studio


Studio's Module Icons

I left off last time talking about Studio.  Studio is a developer's graphical tool to customize Sugar.  The folks at SugarCRM decided that they had different skill levels of developers working with Sugar that needed to customize the Sugar interface so they designed a graphical tool to do just that.

Sugar comes with a bunch of developers tools, each with a singular functionality.  There are tools to rename modules, load modules, create workflows, create dropdown menus, customize the visibility of a module or subpanel, and of course, Studio.  Each of these tools are located in the back-end Admin panel and most are self explanatory and easy to understand.

There is another development tool, Module Builder, for developers who want to develop their own module that we'll review sometime in the future.  Unfortunately, Studio and Module Builder were built by two different developers, and they do not work well together, but more on that in the future.  Let's concentrate on Studio today, a tool to modify Sugar from its out-of-the-box look to something useful for a particular application.

Studio is a visual tool the modifies Sugar modules.  Changes in Studio change the module code by creating files in the custom/modules/[modulename]  directory.  The custom directory allows users to change the Sugar code without modifying the core Sugar files.  That way if SugarCRM came out with an update to Sugar, it will not overwrite your modifications when you upgrade.

Since Studio modifies modules, when you first open Studio you'll see graphical icons of all the modules currently installed.  To modify a module, you click on the module you want to modify.  You're then presented with a new window with icons representing different ways to modify a module: Labels, Fields, Relationships, Layouts, Subpanels, and Mobile Layouts.

To simplify this discussion, I'm going to use the "Accounts" module, as the example module thorough out this article.  You can substitute any other module name for "Accounts" any time I mention "accounts" in this article.

Changing Field Labels

Changing Field Labels

The first tool in Studio, Labels, is for modifying the field names that appear in the various front-end views.  If you want to call a field, "Full Name", instead of "Last Name," then this is where you would change the name.  Sugar conveniently starts all its names with variables starting with "LBL_"  When you change a label name, it changes the corresponding name in the array in the language file for that module.  Language files are in a bunch of places in Sugar: custom/modules/accounts/language, custom/include/language, custom/Extension/modules/Accounts/Ext/language, custom/Extension/application/Ext/Language, custom/application/Ext/Language, modules/Accounts/language, and include/language.  Most of them, but not all, for English have the file name en_us.lang.php.  One of the problems for developers is trying to determine which language file has the field definition you need to change.  Because of the mix of language files, using Studio solves a lot of the problems of which language file to change.

Sugar Data Types

Sugar Data Types

The next module tool in Studio is Fields.  Fields allow you to create new fields and customize existing fields in the module.  If I wanted to add a way to track a special serial number for a record in the database, I would click on "Add Field." This would open the Add Field interface and the first thing you tell Sugar is what type of data you want to store. You can see you have a wealth of data choices in the picture.  Each data type brings up a different form of menu choices about that type of data.  You can tell Sugar what field name you want to use in the database, the label you want that field to have in forms, the default value, and whether it's a required filed the user has to enter before they can save the record.  For example, if you select Dropdown as the data type, you can edit the choices in the dropdown list.  In a new feature, you can link multiple dropdown lists, so if you select a certain dropdown value in a parent dropdown list, only select choices will come up in the child dropdown list.  This can be done graphically in Studio.  When you save the information about the new field, Studio creates a new field in the accounts_cstm table in the database where it stores the data.

Next, we have Relationships.  Studio allows you to create relationships between accounts and other modules. These can be one-to-one, one-to-many, and many-to-many relationships.  If I want to link accounts with contacts, I could set this up by clicking "Add Relationship."  Setting relationships up in Studio does several things.  When you create a new relationship, Sugar will create a new join table in the database.  In this example, that table would be called, accounts_contacts.  Sugar will create a subpanel in the account detail view in the front-end of the application, which will would show the contacts for that account.  Finally, Sugar creates a Sugar Bean for that relationship.  If you remember from my previous article, the Sugar Bean is the equivalent of a PHP ORM for easier coding in PHP.

Studio Layouts

Studio Layouts

Layouts are about what the user sees when they access the front-end of the application.  Just because I created a new field in "Fields" doesn't mean I can see that field in the front of the application.  The "Fields" tool creates the database field to store the data and has nothing to do with being able to see that data in the views.  Layouts configures what fields are visible for each view, and where those fields are placed in the view.  If you click on layouts in Studio, you'll see icons for each view type: EditView, DetailView, ListView, QuickCreate, SugarDashlet, PopupView, and Search.  If you click on any of these icons, the layout for that view or subview is configurable via drag and drop with your mouse.  You click on the module field in the left column and drag to an open row in the main area.  You determine what fields are visible in the front-end by placing them in the main layout area.  You can add new rows or new panels, which comes in below the first panel in the view.  Each view has a left and right column.  You can have a field use both the left and right column, or one side by clicking on the edit pencil icon.  You can rearrange the order of the fields by dragging and dropping them in the place you want them.  When you save your layout, it is stored in an array in a view file in the custom/modules/Accounts/metadata directory.

Subpanels are created when you create a relationship.  They show up below the main view.  They are configured the same way you configure the layouts.  If you have subpanels they are stored in the custom/modules/Accounts/metadata/subpanels directory.

Last we have Mobile Layouts.  These are layouts for your mobile devices and they are configured just like your other layouts.

As you can see, Studio allows you to configure each module in your application.  Modules are normally called from the home page as a menu choice, which then goes to the module/Accounts/account.php file which extend to the core Sugar code, sets up the module, and brings up the module list view and menus to go to the other views.  Studio is helpful to developers in configuring and getting your application just the way you want it.

This ends my articles on the overall view of Sugar from the 50,000 foot level.  I'm going to start digging into the code, and the many quirks of Sugar in future articles.  Before I do that, I want to talk about the Sugar error log, which I'll write about in my next article.

Comments are closed.