O'Reilly logo

Building on SugarCRM by John Mertic

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. What is SugarCRM?

SugarCRM is the world’s largest open source CRM (customer relationship management) software. Founded in 2004, over 7,000 customers and more than half a million users rely on SugarCRM to execute marketing programs, grow sales, retain customers, and create custom business applications. These custom business applications can be used in a multitude of ways, such as to power sales teams, run customer support organizations, and manage customer information databases.

One of the unique things about SugarCRM in the CRM space is that it’s fundamentally an open source application, meaning that the source code of the application is available to any user, developer, or customer of the product. Whether one opts for the AGPLv3 licensed or the commercially licensed version, the application comes with all of the source code, enabling developers to customize and build upon the product with ease. This puts the control of your application and your data in your hands, enabling the freedom to deploy SugarCRM wherever you wish. This ability has given SugarCRM partners and developers worldwide the ability to customize the out-of-the-box application to fit in many different organizations, vertical markets, and locales.

But before we dig in deeper to how you could take the SugarCRM platform and build upon it, let’s take a peek at the various editions of SugarCRM, how and where we can deploy SugarCRM, and some of the components that come with SugarCRM out of the box to enable you to build applications with ease.

A Breakdown of the Editions

The latest version of SugarCRM as of this writing is 6.5, released in June 2012. For this version we expanded the number of editions of the product from three to five, to better cover the various demographics of our customers and better streamline our product support offerings, as well as provide new add-on products to complement the base product.

Community Edition

Community Edition is released under the AGPLv3 license. The Community Edition and related extensions have been downloaded over 12 million times since 2004. This edition comes fully featured with all the basics for sales, marketing, support automation, and user and ACL management, as well as the developer tools Studio and Module Builder for customizing the application. It can be downloaded from http://www.sugarcrm.com/download.

Professional Edition

Professional Edition is a commercial edition of the product that builds upon the feature set of the Community Edition. Of these numerous additional features added to Professional Edition, the most notable are:

  • Support for Teams, where users can be grouped together by their department or job function

  • A reporting tool enabling you to run several different types of reports, many of which have charts with them that can be added to the Home page

  • A web-based mobile version, along with mobile clients specific for the iPhone and Android smart phones

  • Plug-ins for Microsoft Office, namely Outlook, Word, and Excel

Corporate Edition

This is a new edition of the product added with the Sugar 6.2 release, which adds additional features on top of the Sugar Professional feature set:

  • An enhanced mobile client with offline storage capabilities for the iPhone, iPad, and Blackberry platforms

  • A higher level of customer support

Enterprise Edition

Enterprise Edition is targeted at large organizations and builds upon the Professional and Corporate Editions with additional features:

  • A more robust reporting tool

  • An offline client for desktop use

  • Self-service portal, which enables you to deploy a portal that your customers can use to interact with your Sugar instance with ease

  • Sugar Plug-in for Lotus Notes

  • Support for the Oracle and DB2 databases

  • An even higher level of customer support

Ultimate Edition

This is the most feature-complete edition of SugarCRM, and is also a new offering with Sugar 6.2. In addition to all the features in the other editions, this edition adds:

  • Sugar Connector for Lotus Domino Server

  • Our highest level of customer support

What You Need to Install SugarCRM

Because of SugarCRM’s roots as a LAMP (Linux Apache MySQL PHP) application, it is quite easy to get a basic install of SugarCRM up and running. All you need to get going is the following software stack:

  • A computer (either Unix or Windows OSs supported)

  • A web server (Apache 2.x or IIS 6 and 7.x are supported)

  • A database (MySQL 5.1 or 5.5, SQL Server 2005/2008, DB2, or Oracle 10g/11g)

  • A recent version of PHP configured to work with the above components (both PHP 5.2 and 5.3 are supported)

  • A web browser to access the application (IE 7/8/9, Firefox, Safari, and Chrome are supported)

If you are running a recent Linux distribution, all of these components should readily be available through your distribution’s package manager (deb, rpm, etc). On Windows, a great way to get the whole stack installed is through the Microsoft Web Platform installer, including SugarCRM itself (see http://www.microsoft.com/web/). And we also provide full stack installers as well for Windows, Linux, and OS X, which include a web server, database, PHP, and SugarCRM all ready to go for ease of installation.

The application installer for SugarCRM is web-based, so all you need to do is unzip the downloaded package somewhere in your web server root, navigate to the location you unzipped the file with your web browser, and follow the step-by-step instructions. This makes it very simple to get an instance up and running quickly, and means you don’t need any special hardware if you just want to check out SugarCRM and play with it.

How About Running in the Cloud?

One of the biggest gains in having such simple deployment requirements is that you can easily install SugarCRM anywhere these components exist. So while for some that may mean installing SugarCRM on a machine in your server closet or data canter, others may not want the overhead of purchasing or maintaining hardware. This is a growing trend in IT, and has resulted in growth of a concept called “Cloud Computing,” where the applications physically reside in a shared data canter far away and you access the application instance over the Internet. This can provide an organization huge cost savings over hosting the application themselves and dealing with the hardware and personnel costs of doing so (not having to buy server hardware, not needing extra IT staff to maintain the servers, etc).

SugarCRM was designed from the beginning with this in mind. By relying on the LAMP stack, you can deploy on any platform that provides those components, even cloud-based ones. Customers have deployed SugarCRM very successfully on cloud platforms such as IBM Cloud, Amazon EC2, Rackspace, and others. And as part of any commercial edition licensing, you can run SugarCRM on Sugar’s own cloud at no extra charge where they will maintain and handle upgrades of SugarCRM.

There isn’t a cloud that’s a stranger to SugarCRM.

What Do You Get with SugarCRM?

Above you learned all about the various editions of SugarCRM and the differences between them. As you can infer, the biggest changes between the editions revolve around additions to the product (such as external integration products, extra support, or additional modules). This means that the core parts of the product are virtually the same between all the various editions of the product. This design is intentional, as we want the most robust and stable platform to build the features our customers need to keep their organizations running. The advantage for developers is that you can use these base-level components as a platform for building any sort of application.

Let’s take a quick look at what features SugarCRM provides to make it an ideal platform on which to build.

Modular Design

The application is designed to be modular by its very nature, which is a good design paradigm for any software platform. Each part of the application, whether it’s account management, contact management, calendaring, or campaigns, is its own module. These modules can interact with one another through data relationships. For example, an account can have many associated contacts with it, or a call can be scheduled for a contact.

The beauty of the Sugar platform is that you can build upon this base by customizing these modules by adding new fields, additional relationships between modules, and business logic. And you can take things a step further and easily design new modules using Module Builder based upon common module design templates, or a clean slate with custom-built forms and relationships. By keeping a modular design, it makes it easier to customize and build the application exactly how you need it, and at the same time leverage all the existing functionality the platform offers.

MVC Framework

MVC, which stands for Model View Controller, is the primary design pattern for web-based applications today. The reason for this is in its simplicity; by keeping your development assets in a defined area, it makes the overall structure and flow of your application cleaner and clearer. It does this by enforcing a separation of business logic and presentation logic, and having a layer in between them that handles the communication and flow of the application as a whole. Figure 1-1 visualizes this pattern.

Diagram of the Model View Controller paradigm
Figure 1-1. Diagram of the Model View Controller paradigm

SugarCRM leverages this design pattern as the primary request flow in the application. Inside the platform, each module provides a primary controller, which handles the incoming requests and deals with them correctly, directing them to views, which handle the presentation logic. And each module also provides one or more model classes that handle the interaction between the application and the data store underneath, whether that be a traditional database, web service, or some other sort of data store. We’ll dig more into how you can customize and work with this in the examples in Chapter 4.

Metadata-Driven Views

One common thread that often appears with many business applications is that the same kinds of views (or screens) are used over and over again. This is especially true with SugarCRM, as the primary views a user works with are those for creating and editing a record, viewing the details of a record, and searching on and listing the records available in a module. But these views certainly aren’t static, as each module and each user expects different fields with different characteristics to be available. Using the approach of straight HTML forms for each would create a severe code maintenance and quality issue, as on the back end we’d have lots of copying and pasting of templates all over the place, which results in sloppy code and bugs.

We were running into this same issue back before SugarCRM 5 a few years back, so we chose to remedy the situation by implementing metadata-driven views. This allows you to define the fields to be displayed in the given form and some characteristics of them, such as the field label or custom parameters to be passed to the underlying HTML content.

Then this metadata is taken and used to build a dynamic HTML form that is defined as a template, so that it understands the given metadata format and can build the resulting HTML content to be returned to the browser. This process makes it much easier to customize and build forms, removing the need for digging into the details of HTML markup to build common forms.

This process also enables easier customization of forms using other tools, making it possible to edit these forms through Studio and Module Builder without having to touch code at all. We’ll learn more about these tools in Chapter 2.

User Authentication and Access Control

Probably the most important part of any multi-user application is how to make sure access to the application and the stored data is secure and well protected. Data security issues have become one of the biggest challenges any IT department faces these days, and the threat is not only from outside attackers, but also from regular users of the application. This puts the pressure on developers to add sophisticated security features, which can be difficult to implement properly in an extensible way. Figure 1-2 shows what Role Access Control Management looks like.

Role Access Control Management in SugarCRM
Figure 1-2. Role Access Control Management in SugarCRM

SugarCRM, being designed from the ground up as a multi-user business application, comes with advanced data and application security out of the box. You can define users with login credentials in the system (that can also tie back into an existing LDAP or other type of authentication system) to restrict access to the application as a whole. Each user then can have multiple role permissions applied to them, so you can have fine-grained control over the areas of an application a user can access.

This is further strengthened in the commercial editions, where Team support and field-level ACLs (access control lists) allow administrators to more effectively manage large numbers of users with very low-level control over how they can interact with the application. So for example, you could have data entry people only allowed to edit records in a module assigned to them, making all other records effectively read-only in the process. Or, you could define administrators for certain areas of the application (say for Account and Contact management) yet not allow those administrators to administrate other areas of the application that they shouldn’t be allowed to.

External Services Integration

It’s a wide wide world, and this is so very true when it comes to the software world. There are lots of web services, legacy applications, or other tools that contain data we want to get after and use. We’ve seen this theme emerging, and have built frameworks inside of SugarCRM to make this easy to leverage in a universal way.

The first way is through the Connectors framework. This framework enables you to add in-record, on-demand integrations to external Web services with ease. By default we include integration with LinkedIn, the popular professional social network, which allows you to look up information about the various people and organizations stored in your SugarCRM application. Other integrations to InsideView and Hoovers come with the different editions of SugarCRM, and developers have built additional integrations using the Connectors framework with Google, Twitter, and many other services. See Figure 1-3 for an example of using this with LinkedIn.

LinkedIn Connector
Figure 1-3. LinkedIn Connector

We then added a secondary way of doing more in-depth integrations using a specific API, which can better consume content of these applications and services. This has enabled integrations to services using OAuth and other forms of Authentication, such as Twitter, Facebook, and WebEx. This API is very extensible to allow developers to add the logic for connecting to other services and leverage them directly inside SugarCRM. We’ll look at some examples of building this kind of integration in Chapter 5.

Web Services API

Just as you are able to connect to outside services from within SugarCRM, you can also connect back to your SugarCRM instance via Web services. Web services are a way that you can interact with an application over the HTTP protocol. SugarCRM provides support for the two most popular web service protocol standards: SOAP and REST.

Web services provide a clean, non-invasive way to interact with your SugarCRM. You can do just about anything a normal user could do in SugarCRM via the web services API, including adding new records, editing existing records, deleting records, and searching for records by a given criteria. These operations are valid for any module provided with SugarCRM by default, and are also available with custom created modules and fields. We’ll look into how to work with this API in Chapter 5.

Ease of Administration

The most forgotten part of any application is the administration interface. I find this the most important piece of an application, since this makes an administrator’s life much easier for the common tasks they need to accomplish on a regular basis. It also can help streamline maintenance of the application, as you can have simple forms to handle tasks that would be quite complex otherwise. Figure 1-4 shows the Administration panel.

Administration panel
Figure 1-4. Administration panel

SugarCRM has an entire administration section, and with access control limits, you can control which users can access this and for which modules the user has access to. And if you build custom modules, you can also add administration panels for controlling the features of them.

Easy to Use Developer Tools

Since most people don’t want to have to dig into source code or configuration files when they need to change or modify the fields or layouts in the application, we’ve created a few different GUI tools to simplify the process. These tools make most common customizations you’ll do in SugarCRM very simple. Figure 1-5 shows what these tools look like.

SugarCRM Developer Tools
Figure 1-5. SugarCRM Developer Tools

Here’s the breakdown of the GUI tools provided in SugarCRM:

  • Studio is a tool for modifying the out-of-the-box modules, enabling adding and editing fields, changing layouts, and adding new relationships to other modules. The commercial editions of SugarCRM also contain a support for Sugar Logic, which is a way to easily create calculated field values and control field visibility based on formulas that can be built with a GUI-based Formula Editor (we’ll see how this in action in Chapter 3).

  • Module Builder enables you to build new modules, which you can deploy on the current instance or package up for deployment on a different SugarCRM instance.

  • Sugar Portal Editor (Enterprise and Ultimate Editions only) allows you to customize the self-service portal

  • Dropdown Editor allows you to edit the display fields and database values for the various dropdown fields used throughout the application.

  • Workflow (Professional, Corporate, Enterprise and Ultimate Editions only) allows you to create business logic actions when a record is created or changed in a defined way.

We’ll learn more about these tools in Chapter 2, and put them in action in Chapter 3.

Upgrade Safeness

I’ve implemented and integrated with various software solutions many times in my 10+ years of software development experience, both with open source and commercial products. The biggest pain I’ve always run into is making changes to the application safely; often times I’ve had customizations broken or overwritten, sometimes causing problems throughout the application. I’ve even had software packages I’ve refused to upgrade because of the customizations, and as a result lose out on all the fixes and updates provided by newer versions.

SugarCRM takes upgrade-safeness seriously, providing a multitude of ways to make customizations to the application without causing pain when you are upgrading the base product. You will see with the work we do in Chapters 4 and 5, all the code created is put in a special area set aside for developer customization, and we don’t alter it during the upgrade process.


In this chapter, we looked at a brief overview of SugarCRM, considering the various editions of the product and deployment options. We then looked at the various platform features that make SugarCRM such a compelling platform to build an application on top of.

Now that we have some background on SugarCRM, let’s dig more into the developer tools of SugarCRM, and how we can use them in helping to use SugarCRM as a platform for building applications.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required