DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: SugarCRM¶
refresh: | 60 |
---|---|
Created: | 2010-08-05T13:49:41 |
Changed: | 2010-08-05T15:13:51 |
Classification: | eu_sugarcrm |
Keywords: | forAdmins, forIntermediate |
Author: | Christian Lerrahn |
Email: | christian.lerrahn@cerebrum.com.au |
Info 4: | |
Language: | en |
EXT: SugarCRM - eu_sugarcrm
EXT: SugarCRM¶
Extension Key: eu_sugarcrm
Language: en
Keywords: forAdmins, forIntermediate
Copyright 2000-2010, Christian Lerrahn, <christian.lerrahn@cerebrum.com.au>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.org
Table of Contents¶
`Introduction 3 <#__RefHeading__2686_662751858>`_
`Users manual 4 <#__RefHeading__2692_662751858>`_
`Administration 5 <#__RefHeading__2694_662751858>`_
`Configuration 7 <#__RefHeading__2714_662751858>`_
`Tutorial 9 <#__RefHeading__2764_662751858>`_
`Known problems 13 <#__RefHeading__2984_662751858>`_
`To-Do list 14 <#__RefHeading__3000_662751858>`_
`ChangeLog 15 <#__RefHeading__3008_662751858>`_
Introduction¶
What does it do?¶
This extension uses the web service of SugarCRM 5.x to create or update records based on data from a TYPO3 website. An example is the creation of leads and tasks out of a contact from.
Users manual¶
Please refer to the tutorials for an in-depth study of how to use this extension.
Administration¶
- Install the extension normally via the extension manager
- Configure the connection parameters.
- The connection is defined by
- URL to Sugar's file “soap.php”
- User name of a SugarCRM user
- Password of the respective user
- Configure proxy server (optional)
- There is also one additional switch which is only used if you use the sr_feuserregister integration. If you set this switch, editing of user records will propagate into the SugarCRM table. If the switch is off, only user creation events will lead to a record being created in SugarCRM.Technical information; Installation, Reference of TypoScript, configuration options on system level, how to extend it, the technical details, how to debug it.
((generated))¶
The test plug-in¶
This extensions ships with a test plug-in which serves the purpose of testing your connection with and authentication to the SugarCRM server. It allows you to configure certain test individually, so that you can test specific common sources of error. The test() function of the SugarCRM SOAP interface (cf. Section The SugarCRM web service) will always be executed, if there is either a test string (see form in Illustration 1) or no specific tests have been selected. This prevents from the plug-in not outputting anything while it is still rather useless to have an empty string played back by the SugarCRM server.
Illustration 1: The Test Plug-In
As shown in Illustration 1, you can select from the following options.
SERVER_VERSION¶
Test
SERVER_VERSION
Description
This will play back a string like “The Server Version is X.X.X”
LOG_IN¶
Test
LOG_IN
Description
This will make the plug-in try to log in to the server using the credentials you provided when you installed the extension. The result (success or failure) will be reported on screen.
LIST_USERS¶
Test
LIST_USERS
Description
This will query the SugarCRM server for the list of all users and output them along wit their details. This switch implies the LOG_IN switch.
LIST_MODULES¶
Test
LIST_MODULES
Description
This will query the server for all available modules and output a list. This switch implies the LOG_IN switch.
LIST_MODULE_DETAILS¶
Test
LIST_MODULE_DETAILS
Description
This will not only query the list of modules but also obtain all their details and display them along with the respective module. This switch implies the LOG_IN switch.
BE AWARE that this might take a long time to render!
- If you access your SugarCRM in any other way than through localhost (or at least if it is not a super-fast network connection), you should most likely refrain from using LIST_MODULE_DETAILS and if possible even LIST_MODULE_DETAILS and LIST_USERS. They run a lot of queries as separate HTTP POST requests and can therefore take very long to process. If that takes longer than your maximum execution time on your PHP install, they will even time out.
- As a general note, you should be aware that this is a mere test plug- in. There is no reason why it would ever show up on a production website. Use it to test your connection and then delete it from all pages again.
Configuration¶
((generated))¶
The SugarCRM web service¶
- The extension uses the SugarCRM web service. Type in the URL
http://<your sugarcrm url>/soap.php to see the methods offered by the
SugarCRM web service. Currently, eu_sugarcrm implements the following
methods.
- test
- get_server_version
- get_sugar_flavor
- login
- logout
- user_list
- get_available_modules
- get_module_fields
- get_entry
- get_entry_list
- search_by_module
- set_entry
- Typically, a request to SugarCRM consists of the methods „login“,a number of other methods and „logout“.
Use of the web service via TYPO3¶
eu_sugarcrm can be used in four ways:
- Use the built-in MAILFORM content element. The actions are defined in an additional configuration field.
- Create a content element of type “plug-in” and choose “SugarCRM test”. This will output some information from the CRM system and allow you to check your installation.
- Hook into sr_feuserregister to keep TYPO3 FE user accounts in sync with tables in SugarCRM.
- Write your own extension which uses eu_sugarcrm.
Reference¶
- This extension hooks in to the TYPO3 content element “Form”. Therefore all configuration is done through additional fields for this content element. The extension is configured in a TypoScript like style which configures the SOAP object used to send the new data to the SugarCRM interface and map the form data to the SugarCRM database tables.
- All top level objects in the configuration have a skeleton of the form
ObjectName {
type = <SugarCRM module name>
[identifier = <SugarCRM field name>]
[identifier.case = 0]
[timeshift = <hours>]
[form.condition = <tests>]
[input_dateformat=<format string>]
default {
<default data>
}
mapping {
<mapping data>
}
[children {
<child object data>
}]
}
Description of Properties¶
ObjectName¶
Property
ObjectName
Description
This top level object can have any name but the name might not contain spaces. For every top level object, one independent record will be created.
type¶
Property
type
Description
The name of the SugarCRM we want to use. Usually this will be 'Leads' or 'Contacts'.
identifier¶
Property
identifier
Description
If this is set the table will be searched for a matching record first. If found, the record will be updated. If not, a new record will be created
If identifier.case is set, the field name is considered case sensitive. Otherwise it will be converted to lower case.
timeshift¶
Property
timeshift
Description
The time shift in hours (with respect to GMT) for the time zone that applies to the input. SugarCRM always seems to store timestamps in GMT.
form.condition¶
Property
form.condition
Description
If you want an object only to exist if one or more form fields have certain values, you can set a condition like
<form field>=<value>
here. You can use the operators =,!=,<,>,<= and >= for the tests. Only simple tests are allowed, no logical expressions.
input_dateformat¶
Property
input_dateformat
Description
The format input dates (and times) should have, e.g. d-m-Y . Valid placeholders are d (day), m (month), y (2-digit year), Y (4-digit year), H (hour), M (minute).
default¶
Property
default
Description
This section sets SugarCRM database fields to constant values. The syntax is
<database field> = <value>
mapping¶
Property
mapping
Description
This section describes how form fields should be mapped to SugarCRM database fields. The syntax is
<database field> = <form field>
children¶
Property
children
Description
This is an optional object which contains an arbitrary number of child objects which are relating to the original record. The objects within this section have the same structure as their parent. This can be used to attach calls, tasks, etc. to the created lead or contact.
Tutorial¶
((generated))¶
Example 1 – mail form integration¶
- How to use the web service for integration with a mail form will be explained by means of a concrete example in which a visitor fills out the contact form on a website.
- We assume that you have installed and configured and tested that you are connecting to the SugarCRM instance (see test plug-in for how to do this)
Setup the form¶
Create the contact form on the page using the standard mail form content element.
Illustration 2: Configuration of web form
In our example the following form definition was used.
Salutation: | *Salutation=select | Mr, Ms.
Firstname: | *FirstName=input,25
Name: | *Name=input,25
Company: | Company=input,25
Phone: | *Phone=input,25
e-Mail: | *email=input,25 | | email
Please give me a call: | Recall=check |
Preferred date and time: | DPC_Date=input,16
Message: | *Query=textarea,40,8
| formtype_mail=submit | submit
| html_enabled=hidden | 1
| subject=hidden | Online-Contact
Configure mapping to SugarCRM¶
You will notice that there are additional options for mail form content element now. To use the SugarCRM integration, select the “create SugarCRM Lead on form submit” option. You then will need to configure how the field data is submitted to SugarCRM. This includes setting up whether the data should create new lead or contact or update data, and how the form fields map to the sugar fields.
The settings are entered in a syntax similar to TypoScript as shown in Illustration3: Configuration of SugarCRM binding (eu_sugarcrm).
Illustration3: Configuration of SugarCRM binding (eu_sugarcrm)
The full configuration for our example is listed below.
FirstContact {
// what to create?
type = Leads
// require unique e-mail address
identifier = email1
default {
lead_source = TYPO3 Online Contact
// Who is the lead assigned to?
assigned_user_id = jim_id
}
// Allocation SugarCRM Filed = Form Field
mapping {
first_name = FirstName
last_name = Name
email1 = email
salutation = Salutation
phone_work = Phone
account_name = Company
}
// create linked entries
children {
Task {
type = Tasks
// Only create task. if checkbox is active
condition.form = Recall=0
default {
name = Answer online query
priority = Medium
status = Not Started
assigned_user_id = jim_id
parent_type = parent.type
parent_id = parent.id
}
mapping {
description = Query
}
}
Call {
type = Calls
condition.form = Recall=1
// Which format is the date entered into the form in?
input_dateformat = d-m-Y H:M
default {
name = Call online contact
priority = Medium
status = Planned
direction = Outbound
reminder_time = 600
duration_hours = 0
duration_minutes = 15
assigned_user_id = jim_id
parent_type = parent.type
parent_id = parent.id
date_start = now
time_start = now
}
mapping {
description = Query
date_start = DPC_Date
date_end = DPC_Date
}
}
}
}
- In this example if the email address of the visitor is already present in SugarCRM (in the field email1), the lead information will be updated. Otherwise, a new lead will be created. As a second step, an appointment and a task will be created for this first lead.
- The allocation of the data to a SugarCRM user is set by the the value of assigned_user_id in the configuration, it is important to understand that this is the user id rather than user name from SugarCRM. In our example jim_id is the value of the default example user id in SugarCRM. To get you users id's it is easiest to use the test plug-in and run LIST_USERS. You can also use LIST_MODULE_DETAILS in the test plug-in to find out the SugarCRM field names. However, bear in mind that a lot of information will be gathered from the SugarCRM and output in your browser.
- Alternatively (and preferably), you can get the SugarCRM field names for a module from within SugarCRM by accessing the Studio (in Admin area), selecting the relevant module and listing its fields.
Example 2 – sr_feuserregister/felogin integration¶
- eu_sugarcrm can also be used to keep your FE users and your SugarCRM database in sync. Local records are updated on login via a hook in the felogin extension and remote records are updated via hooks in sr_feuserregister. Currently you can only synchronise both ways but not disable one way of synchronisation.
- The configuration is done like for the mail forms. However, it has to be written into the TS template and the objects as laid out in example 1 need to be children of the object config.tx_eusugarcrm. This could look as follows
config.tx_eusugarcrm {
SiteUsers {
// what to create?
type = Contacts
// require unique e-mail address
identifier = uid_c
default {
lead_source = Web Site
// Who is the lead assigned to?
assigned_user_id = jim_id
}
// Allocation SugarCRM Field = Form Field
mapping {
first_name = first_name
last_name = last_name
email1 = email
uid_c = uid
}
}
}
With this configuration a new user will be created if no user is found where the uid in fe_users matches the uid_c field in SugarCRM's Contacts table. The unique identifier ensures that users that already exist on both systems are kept in sync. If you do not use a unique identifier, you will create a new record in SugarCRM every time an FE user logs into TYPO3 (via felogin) and FE user records will never be updated from SugarCRM.
Known problems¶
Security issues¶
When SugarCRM is employed as a productive CRM system, the following potential security gaps should be given special attention:
- The SugarCRM web service has to be accessible from outside, consequently the internal web server is exposed to attacks from the internet. To limit the impact to security, please configure your firewall to allow connections to the internal web server only from your external web server.
- TYPO3 pages should be secured with a login, and protection against automatic sending of forms should be checked.
- The open source version of SugarCRM offers no access rights administration.
- The communication between TYPO3 and SugarCRM can be handled via HTTPS. The user name and password of a SugarCRM user are nevertheless saved in the TYPO3 database.
- A sophisticated installation will minimise the security risks. Nevertheless, exposing an internal system always carries with it some risk. Someone accessing his internal mail server from a web frontend on the internet has hopefully already considered the risks and expects no problem with this procedure.
To-Do list¶
- allow logical expressions in conditional objects
- implement better method of getting time zone right
- allow for one-way synchronisation between TYPO3 FE users and SugarCRM Contacts/Leads
ChangeLog¶
0.3.1¶
Version
0.3.1
Changes
fixed manual and migrated to new template
0.3.0¶
Version
0.3.0
Changes
- complete rewrite of SOAP code (now using the much faster PHP SOAP interface)
- integration with sr_feuserregister to synchronise fe_user table with SugarCRM tables
- renamed TS property uniqueEmail to identifier (now more generic)Added / Changed/ Caught error
0.1.10¶
Version
0.1.10
Changes
- fixed sample configuration in manual
- updated contact or lead only if existing record in same category as configured
0.1.0¶
Version
0.1.0
Changes
- test plug-in now allows for running different kinds of tests
- (connection, server version, login, module list, etc.) separately
- added flexforms to configure test plug-in
0.0.2¶
Version
0.0.2
Changes
- updated for SugarCRM 5.0
- type attribute is now identical to Sugar's module name, e.g. "Leads". In previous versions it read "Lead".
- splitting of dates (date + time) has been removed in SugarCRM 5. Existing contact forms have to be updated to deliver the full date.
15