Using Objects with SugarCRM
You can create objects that map to SugarCRM objects (for example, Leads), using SugarCRM as an external storage system. Once integrated, the Liferay object’s data is stored only in SugarCRM. Both systems are updated automatically whenever users add, update, or delete entries in either context.
To use this feature, enable the Proxy Object (LPS-135430) feature flag.
Preparing SugarCRM
In SugarCRM, you must generate an OAuth key to configure API integration with Liferay. After that, you can connect Liferay to SugarCRM.
Liferay uses OAuth2. When generating the OAuth key in SugarCRM, choose OAuth 2.0 in the OAuth Version field.
Gathering Information to Connect SugarCRM with Liferay
Gather the information Liferay requires to retrieve an access token and connect to your SugarCRM instance using an OAuth password grant:
- The URL to your instance’s root API endpoint
- The URL to the endpoint for retrieving the OAuth token
- The Consumer Key to the generated OAuth Key
- The user name and password of a SugarCRM administrative user
After establishing the connection, gather some information about the SugarCRM object.
Gathering Information about the SugarCRM Object
Before creating your Liferay object, ensure the SugarCRM object includes all desired fields. Define any missing fields before linking with Liferay object fields.
In addition, use the SugarCRM API to inspect the object and its fields. You must obtain the following information to map your Liferay object to your SugarCRM object:
- An OAuth token to make authenticated requests to the REST API
- The GET endpoint of the object (known as a module in SugarCRM), to use as the object definition External Reference Code (ERC) in Liferay
- Each field’s name as returned by the object’s GET API endpoint, to use as the ERC in the Liferay object’s corresponding fields
Configuring Your Liferay Instance
-
Open the Global Menu (), go to the Control Panel tab, and click Instance Settings.
-
Click Third Party and go to the SugarCRM Integration entry.
-
Fill out the configuration form with the details gathered from your SugarCRM instance.
Access Token URL: The URL to your instance’s root API endpoint
Base URL: The URL to the endpoint for retrieving the OAuth token
Client ID: The Consumer Key to the OAuth Key
Grant Type:
password
Password: The password of a user with the proper permissions that can authenticate to SugarCRM
User Name: The user name of a user with the proper permissions that can authenticate to SugarCRM
-
Click Save.
Creating an Object with the SugarCRM Storage Type
To create a proxy object for storing data in SugarCRM, follow the usual process, but select the SugarCRM storage type. This configures the object to use SugarCRM as an external storage system.
While creating the Liferay object draft, edit the ERC to match the last part of the SugarCRM object’s REST endpoint resource path. For example, if the endpoint ends with /Contacts
, you must use Contacts
as the ERC.
Add object fields for every field in the SugarCRM object to prevent data loss. Ensure each field corresponds to a field in the SugarCRM object. Then edit each field and add external reference codes that link to the desired SugarCRM fields. For each ERC, use the name of the corresponding custom SugarCRM field (e.g., last_name
, etc.).
You must ensure each Liferay object field’s ERC matches the field name returned by the SugarCRM REST API for the corresponding object. For example, a First Name field in the Liferay object must use first_name
as the ERC to map to the first name in this theoretical SugarCRM object JSON:
{
"name": "Lord Voldemort",
"first_name": "Tom",
"last_name": "Riddle",
"title": "Lord"
}
Once published, the Liferay object’s data is only stored in SugarCRM. Both systems are updated automatically whenever users add, update, or delete entries on either side of the relationship.