Archives For Sugar 7.6.0

UPDATE July 24 2017

Sugar 7.9.0 introduced a Platform extension. This should be used for registering new platform identifiers for Sugar 7.9.0 and beyond.

What does the platform parameter mean in v10 REST API?

If you open your web browser’s network tools, a login request to the v10 REST API used in Sugar 7.6 will typically look something like the example below.

POST /rest/v10/oauth2/token HTTP/1.1
Host: localhost
Cache-Control: no-cache
Content-Type: application/json
{
     "grant_type": "password",
     "username": "admin",
     "password": "admin",
     "client_id": "sugar",
     "platform": "base",
     "client_secret": "",
     "current_language": "en_us",
     "client_info": {
         "current_language": "en_us"
     }
}

You can see in the request that we have specified a platform parameter called “base”. This parameter is optional (the default is base) so even if you have used the v10 REST API before you may not have been aware of it or what it means.

Continue Reading…

Here is another guest post from Cédric Mourizard from the Elite SugarCRM Partner Synolia.  Cedric is a well recognized expert on the Sugar PDF Manager.

In regard to some recent questions from Sugar Community stalwart, Francesca Shiekh, we will address some questions about how to deal with the PDF Manager that was originally introduced in Sugar 6.

A Common Use Case

In this article we want to resolve this common use case for customizing the PDF manager. When following up on a meeting, you want to be able to generate an attractive summary document that lists all the meeting details included lists of those who were invited or attended.

We will customize the PDF manager so that we can print a meeting summary for any Meeting record that will have all contacts and invited users listed.

Continue Reading…

Getting 3rd party JavaScript into Sugar

The most common UI integration point between Sugar and external applications is the trusty Sugar Dashlet. This is why we spend so much time talking about Dashlets here on the blog and at our Sugar Developer events throughout the year. However, if you are building something more complicated than an iframe dashlet integration then there is often a requirement to pull 3rd party JavaScript into the page. For example, many integrations are facilitated using JavaScript API client libraries.  Or there is code that a developer is trying to reuse that relies on JavaScript libraries that Sidecar does not already use.

Out of the box, this developer has a couple different options:

Use JSGroupings Extension

Using JSGroupings extension allows you to include additional JavaScript files with the core Sugar application JS that is pulled into the page when the Sugar application is loaded. The drawback is that this JavaScript will get pulled into the page whether or not it is ever used by a user.

Adding script tags to page dynamically

You could add script tags to your Handlebars template or via a Sidecar controller. But this approach adds a bunch of ugly complexity to your code as you have to manage many routine tasks related to loading scripts.

Providing another way!

But Sugar gives us the tools we need to design another way! Below we will explore using the Sidecar plug-in framework to provide an easy way to dynamically load JavaScript and CSS for use with your custom Sidecar components.

Continue Reading…

Here is a guest post from Shijin Krishna from BHEA, an Elite SugarCRM Partner, and active member of the Sugar Developer community.

Are you interested in posting on the Sugar Developer Blog? Contact developers@sugarcrm.com with your idea.

In this post we are going to see how we can add a quick create pop-up view for related modules in record view. This idea is taken from Sugar Portal which comes with Sugar Enterprise, Ultimate and Corporate editions. Sugar Portal’s detail view for Bugs and Cases modules includes an action to add a note to the bug or case. In this post, we are going to see how we can create a similar quick create pop up on the base Sugar 7 web client which will be shown at the click of a button. Continue Reading…

Sidecar and Backbone.js

The Sidecar user interface framework is built on a variety of browser side technologies.  Being proficient in these underlying technologies is important for any developer writing Sugar 7 user interface code.

They key JavaScript component that pulls Sidecar together is Backbone.js. Backbone provides the underlying structure to Sidecar as well as providing a rich set of base features and APIs that are heavily used throughout the Sugar 7 application.

Sugar 7.6.x uses Backbone 0.9.10.

If you’ve ever created a Sugar Dashlet or any other user interface component in Sugar 7 then you will familiar with Backbone concepts such as customizing a View or working with a Model. However, many loosely coupled customizations or integrations with Sugar 7 user interface are possible through the use of Backbone Events.

For server side code, recall that you can use Logic Hooks to trap a Module’s save events instead of overriding a module’s SugarBean.  The same pattern can be applied where instead of overriding a core file, you can listen to essential events and take action as they occur.

We will explore more below.  The code from this example is also available on Sugar Integration Building Blocks project in Github.

Continue Reading…

What are Sugar Integration Building Blocks?

This is a new effort to create an open source library of re-usable common components that can be easily adapted by developers interested in integrating applications with Sugar 7.  This project is focused on the needs of SugarCRM ISVs and Technology partners that want to build integrations and get them listed on Sugar Exchange quickly and painlessly so they can be offered to Sugar customers.

This new open source project is hosted on Github at https://github.com/sugarcrm/BuildingBlocks and is accepting contributions from the Sugar Developer community.

Watch this project because more and more components and examples will be added in the coming months.

Contextual Frame Dashlet Package

One of the first building blocks is an easy to use iframe dashlet that passes contextual information about the current page to the iframe using URL parameters.  In the current package, the context that is passed is the record id (when there is one) and the module name.  The external endpoint can then use that context to create an appropriate UI to present in the iframe.

This dashlet can be easily used to create a lightweight UI integration with an external application.  It can be deployed as-is for a Proof of Concept or demonstrations or it can be easily customized for additional tailored capability.

Contextual iFrame Dashlet configuration page

Contextual iFrame Dashlet configuration page

It also happens to be a good example of a Dashlet that uses a configuration page in order to manage settings such as the base URL and the frame’s height.

Continue Reading…

In a previous post, we learned how to write JavaScript unit tests using Sugar 7’s Jasmine framework.  Today we will learn how to write PHP unit tests using Sugar 7’s PHPUnit framework.  If you do not have access to Sugar 7 unit-tests Github repository and you are a current SugarCRM customer or partner then you should request access.

This post will assume that you are already familiar with PHPUnit fundamentals.  If not, you can check out their Getting Started Guide.

Even if you do not have access or choose not to use the Sugar 7 PHPUnit framework, readers should still find the concepts covered in this post useful for testing Sugar 7 code.

Testing a Logic Hook

We will start with a realistic code customization so we can create a useful example of some unit tests.  There are a variety of server-side code customizations that are possible within Sugar 7 but perhaps the most common example would be the Logic Hook.  If you’ve done any significant amount of development on Sugar then you’ve like likely written more than one logic hook.  Sugar logic hooks have been an important tool in the Sugar Developer’s toolbox since well before the release of Sugar 7.  So this is a very appropriate example for us to use.

Continue Reading…