Sugar REST PHP Client

A new open source library for working with Sugar 7’s powerful REST API has just been published! You can view the library in our GitHub account here:

Full instructions for installation, usage, current included API Endpoints, and ways to contribute can all be found in the GitHub Wiki on the repository.

Who should use it?

The Sugar REST PHP Client was built initially to make working with Sugar instances easier for some of our internal tools. I wanted to provide a quick, easy, and object oriented, way to access Sugar 7’s REST API that could be used by all PHP developers. Any developer who is developing PHP applications that integrate with Sugar 7 should be interested in using the new library. The simplified architecture takes away the hassle of setting up and managing Curl connections, and allows the developer to focus on what matters most, which is working with the data in their Sugar application.

Continue Reading…

This post originally appeared on the SynoLab blog hosted by Synolia, an Elite SugarCRM Partner. This post describes how to extend the new Sugar CLI framework to add commands that allow Sugar Administrators to monitor the Sugar e-mail queue.

Since the Sugar version, SugarCRM introduced a Sugar CLI tool based on Symfony Console. This Sugar CLI tool is under beta version at this moment (August 2016) and can be changed in the future.

We will see in this article how to use this new Sugar CLI to add a command which provides some statistics from the Email Manager Queue. We want to display how many emails by campaign by module are waiting to be sent.

The first step is to define the Command itself

To perform this operation we implementSugarcrm\Sugarcrm\Console\CommandRegistry\Mode\InstanceModeInterface because our command must be executed only on an installed Sugar instance. The only required things to do is to provide the command name, the description, and the help text on the configure() method and then to implement our logic in the execute() method. We are using a SugarQuery to retrieve the data and display the result on a table. We can imagine externalizing this part and using it in an API and creating unit tests.

//File: custom/Synolia/EmailMan/Console/Command/ListQueueCommand.php
namespace Synolia\EmailMan\Console\Command;

use Sugarcrm\Sugarcrm\Console\CommandRegistry\Mode\InstanceModeInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableSeparator;

 * Email Manager Queue statistics
class ListQueueCommand extends Command implements InstanceModeInterface

     * {inheritdoc}
    protected function configure()
            ->setDescription('Show Email Manager Queue statistics')
            ->setHelp('This command displays statistics from Email Manager Queue.')

     * {inheritdoc}
    protected function execute(InputInterface $input, OutputInterface $output)
        $result = $this->getSugarQuery()->execute();

        $nbEmailsToSent = 0;

        $table = new Table($output);
        $table->setHeaders(array('Campaign', 'Module', 'Count'));
        foreach ($result as $row) {
            $table->addRow(array($row['name'], $row['related_type'], $row['record_count']));
            $nbEmailsToSent += $row['record_count'];
        $table->addRow(new TableSeparator());
        $table->addRow(array('# Emails to send', '', $nbEmailsToSent));

     * @return \SugarQuery
     * @throws \SugarQueryException
    protected function getSugarQuery()
        $sq = new \SugarQuery();
            ->joinTable('campaigns', array(
                    'alias' => 'campaigns',
                    'joinType' => 'LEFT',
                    'linkingTable' => true)
            )->on()->equalsField('', 'emailman.campaign_id');
        $sq->select(array('', 'emailman.related_type'))->setCountQuery();

        return $sq;

Declare the Command

Now we need to make this command available by using the application/Ext/Console framework:

//File: custom/Extension/application/Ext/Console/SynoliaEmailManListQueueCommand.php
->addCommand(new Synolia\EmailMan\Console\Command\ListQueueCommand());

Add our namespace

To use our own namespace we can follow one of the way described in our previous article by using theapplication/Ext/Utils framework:

//File: custom/Extension/application/Ext/Utils/SynoliaEmailManConsoleCommandNamespace.php
SugarAutoLoader::addNamespace('Synolia\\EmailMan\\Console\\Command', 'custom/Synolia/EmailMan/Console/Command', 'psr4');

Perform a Quick Repair and Rebuild et voilà!


Thanks to Jelle Vink about his presentation of this new Sugar CLI tools at UnCon 2016!

You can find more information about Sugar CLI on the Sugar Developer Guide.

We are half way through the SugarCRM Solution Architect Webinar Series and we have had a great turn-out so far with over 400 people coming to our first 4 webinars. Even if you miss the live webinars, you can still go back and watch the recordings on your own time.

For more information on what you can expect, you should read our recent blog post on the webinar series.

Accessing the Recordings

Visit Sugar University’s webinar library for all previous recordings. Recordings are posted usually one or two business days after the live event.

Webinars with recordings are as follows:

1. (Sep 6th) – Introduction to Solution Architecture for Sugar & CRM Project Fundamentals
2. (Sep 7th) – The Sugar Platform
3. (Sep 20th) – Design
4. (Sep 21st) – Integration

Continue Reading…

Sugar Developers now have a new tool for building upgrade safe mobile customizations that address most branding, theming, and mobile security requirements.

Introducing Sugar MACS

Introducing the Sugar Mobile Application Configurator Service (Sugar MACS)! This tool allows Sugar Developers building solutions for Sugar Enterprise customers to create and distribute custom-branded versions of the SugarCRM Mobile app.

Many of you have seen earlier previews of Sugar MACS at SugarCon and UnCon.

Continue Reading…

Sugar Performance Engineer Vadzim Ramanenka shares some tips for profiling Sugar code using our newly launched SugarCRM XHProf Viewer open source project.

Profiling Sugar softly

Whenever you encounter that something is not working as fast as you would like, you need a way to look “under the hood” and understand what exactly is slowing things down. Sugar 7.7.0 added a built-in capability to collect detailed performance profiling data and store it in files. Recently, we released an open source SugarCRM XHProf Viewer project which can be used to visualize performance bottlenecks.


Example of a XHProf call graph diagram

Read on to learn how to configure both Sugar and the Viewer in a few simple steps.

Continue Reading…

You may have heard that SugarCRM will be presenting a series of webinars on solution architecture for the Sugar platform, throughout this September and October.

Beginning on September 6th, Sugar University’s Solution Architect Webinar Series will present the following topics:

  • Introduction to Solution Architecture for Sugar
  • CRM Project Fundamentals
  • The Sugar Platform
  • Design
  • Integration
  • Sugar Implementation
  • Performance and Quality Assurance
  • Deployment
  • Security

Each webinar will be guided by a panel of experts from across SugarCRM, including some familiar faces from the Architecting Successful Projects panel at this year’s UnCon

Continue Reading…

Here is a guest post from Ivica Nedeljkovic from Intelestream which is one of our new SugarCRM Partners. In this post, Ivica explains how you can use Intelestream created Docker containers hosted on DockerHub to easily deploy Sugar.

If I was asked to list the top five technologies in the last 5 years, Docker would certainly be on the list.The real advantage that Docker containers have over other server virtualization software is that Docker uses shared operating systems instead of trying to virtualize hardware. This takes less resources, is easier to boot, and faster to spin up instances.


Docker 1.12

Some performance issues were experienced with Docker containers on OS X and Windows and some security issues were also experienced because up until Docker version 1.12. Until Docker 1.12, the native OS X/Windows virtualization options were not used and 3rd party Linux virtual machines such as VirtualBox were used instead. For virtualization, Docker 1.12 for Windows uses Alpine Linux on top of a Hyper-V VM and Docker 1.12 for Mac OSX uses Alpine Linux on top of a xhyve Virtual Machine.

Docker 1.12  was released in July 2016. In addition to boosting performance it also simplifies the whole process of creating new containers, as you no longer need to use a docker-machine anymore to create virtual machines.

Continue Reading…