Connectors



This guide provides an overview of product features and related technologies. In addition, it contains recommendations on best practices, tutorials for getting started, and troubleshooting information for common situations.

Topics

  • Introduction
    This section covers the design specifications for the connector integration capabilities in Sugar called Connectors. The Connector framework allows for various data retrieved through REST and SOAP protocols to be easily viewed and entered into SugarCRM.
  • Factories
    The primary factory is the ConnectorFactory class. It uses the static SourceFactory class to return a connector instance.
  • Sources
    The sources are the centerpiece of the Connectors framework. There are two categories of sources - REST implementations and SOAP implementations. The default source class is abstract and subclasses need to override the getList and getItem methods. The class name of the source should be prefixed with either “ext_soap_” or “ext_rest_”. This is because the “_” character serves as a delimiter into the file system for the class to be found. For example, a SOAP implementation for a source we call “Test” will have the class name “ext_soap_test” and a REST implementation will have the class name “ext_rest_test”.
  • Formatters
    The optional formatter components are used by the connector framework to render a widget that may display additional details and information. Currently, they are shown in the detail view screens for modules that are enabled for the connector. Similar to the source class, the formatter class has a corresponding factory class (FormatterFactory). The formatters also follow the same convention of using the “ext_rest_” or “ext_soap_” prefix. However, to distinguish conflicting class names, a suffix “_formatter” is also used. Formatters extend from default_formatter. Retrieving a formatter instance is similar to retrieving a source instance except that the FormatterFactory scans in order the ./modules/Connectors/connectors/formatters first and then the ./custom/modules/Connectors/connectors/formatters directories.
  • Class Definitions
    Classes should be named "ExtAPI" and should be placed in the ./include/externalAPI/directory (the directory name should be ./custom/include/externalAPI/ if this is externally created code) with the filename of "ExtAPI.php". There can be other files located in the directory with your class and they will be ignored by the application, the external api class may use these for additional libraries, XML/XSL templates, or any other necessory file. In order for the new external API class to be picked up by the system, it is necessary to flush the external API cache of class names by going to the "Admin" module, selecting the "Repair" link and then selecting "Quick Repair and Rebuild", after this is complete any new external API classes that match the naming convention.
  • Examples