The SugarCRM module is connector for Customer Relationships Management System SugarCRM.
The SugarCRM connector module is not bundled with Magnolia. You can download it from our Nexus repository as magnolia-module-sugarcrm-1.0.1.jar, or include it in your custom webapp by adding following Maven dependency to your pom.
Make sure you're using the version 1.0.1 or higher. The passwords for Accounts created in version 1.0 are not compatible with newer versions.
SugarCRM is a Enterprise Edition module.
Create a backup of your system before you install a module. Uninstalling a module is not as simple as removing the .jar file. Modules add and change configurations and may change the content. Try new modules in a test environment first. A module consists of a JAR file and may include dependent JAR files. Modules are responsible for updating their own content and configurations across versions. Be sure to keep only one version of each module and its dependencies.
To install a module:
- Stop the application server.
- Copy the module JAR files into the
WEB-INF/libdirectory. The location of this directory depends on the application server.
- Restart the server.
- Go to the AdminCentral URL.
- Start the Web update process.
- Click Start up Magnolia.
Repeat the steps for each author and public instance.
To uninstall a module, remove the module JAR file from the
/WEB-INF/lib folder and restart Magnolia.
However, this is rarely enough. Modules add and modify configuration during installation. The use of a module also changes content. Removing all of these changes is difficult without knowing the installation tasks in detail.
To test a module, use the embedded Derby database and take a backup of your
repositories folder. Install the module and try it. When you are done testing, remove the module JAR and restore the
repositories folder from the backup. This way you can go back to square one.
We also recommend that you segregate the development and production environments. Take regular backups for disaster recovery so you can revert to a prior state in a routine fashion.
- Provide URL of your SugarCRM instance (config:/module/sugarcrm/rest-client/sugarCrmHttpClient/baseUrl).
- Rest calls to SugarCRM need to be done as administrator. Please provide admin username and password (config:/module/sugarcrm/rest-client/config). More informations about user authentication.
- We need to authenticate Accounts to be able provide personalised content for them. Accounts are not logged into SugarCRM as Users but only into Magnolia context. You need to provide a custom text field to Accounts module via SugarCRM studio where the passwords will be stored. Define the name of this field under config:server/filters
- Account page: http://localhost:8080/demo-features/modules/sugar-crm/SugarCRM-Account.html
- Login page: http://localhost:8080/demo-features/modules/sugar-crm.html
The first think which we need is a command which performs rest calls to SugarCRM. You can use info.magnolia.sugarcrm.command.SugarCrmCommand class for the basic calls and set property module to the name of SugarCRM module. You need to pass method as a context attribute when executing such command. Other parameter such path and body are optional. You can see PUT rest call to YOUR_SUGAR_CRM_INSTANCE/rest/v10/Accounts/CURRENT_SUGARCRM_USER_ID in the java code below:
|Description||Constant in info.magnolia.sugarcrm.command.SugarCrmCommand||Default value||Available values|
|Path||PARAMETER_PATH = "sugarCrmPath"||Empty string||A string representing path after module name|
|Method||PARAMETER_METHOD = "sugarCrmMethod"||Not defined|
METHOD_GET / METHOD_PUT / METHOD_POST
|Request body||PARAMETER_BODY = "sugarCrmBody"||Empty body||an instance of org.codehaus.jackson.JsonNode|
The samples contain traits for Personalisation module. Those are able to retrieve informations from SugarCRM to provide a personalised content. In this chapter is described on the provided samples how you can create a custom trait . If you've never created a personalised content in Magnolia, please follow Creating+custom+traits.
A SugarCRM trait is a wrapper for json response. Extend info.magnolia.sugarcrm.personalization.trait.AbstractSugarCrmTrait for every trait you want to create since traits are identified by their java classes.
Extend info.magnolia.sugarcrm.personalization.detector.AbstractSugarCrmDetectorFilter to retrieve a trait. Set command in the constructor or via config tree. Don't forgot to order your custom trait detector filter after SugarCrmLoginLogoutFilter on installation. The provided sample for detection of the SugarCRM user account sends POST request to YOUR_SUGAR_CRM_INSTANCE/rest/v10/Accounts/filter with following body:
A trait voter decides if a certain page variant has to be served to the current user or not. There no much difference between a SugarCRM trait voter and any other voter. You can see voter which checks if the detected user has a facebook account registered in his SugarCRM account in the following code:
Preview parameter converter
Parameter converter is needed for Personalization#Personalization-Preview. It Converts String to a corresponding trait class holding a json and vice versa.