Leveraging the Connectors API for storing external service API keys

We have many people who build integrations into SugarCRM that are simply ways to exchange data back and forth between systems. This is a simple process for web services, Sugar call the external system over web services to send data to it, and the other system leverages Sugar’s Web Services API to send data back. We’ve covered the mechanic’s of doing this in the past, but there’s always one stumbling block; how to save the credentials for the other system in Sugar in standardized way. Luckily, the Connectors API provides this tool.

You can easily add another tab in the Connectors Setting area, like shown below, with a few lines of code…

You can create your own tab with 3 easy steps. I’ll use the example of the filepicker.io connector I built to showcase this.

First, create a connector source file that looks like this….

The key pieces here are the two class properties set to false, which lets Sugar know this is strictly a connector without the extra bits of field mapping or data merging.

Next, we’ll define the config file to store the connector settings…

The key piece here is under the ‘properties’ attribute, which let’s us know which properties we need to collect from the admin in the tab shown in the screen above.

Finally, we’ll add in the localization pieces…

You’ll specify the text that goes above the properties on the tab in the LBL_LICENSING_INFO key, and then map each property to the correct display label.

Finally, you can grab this key anywhere in Sugar using this code segment…

I encourage you to check out the full source code for the add-on on GitHub, which should help you better understand where all the files should go and how it works with the manifest file.