Creating Support Tickets from Emails is one of the core functionalities of a ticketing system and it can hugely benefit any organisation if the ticketing system is directly part of the global CRM implementation.
SugarCRM since the early days has included on any version of its CRM product a great functionality that is commonly used between my customers: the Inbound Email to Case creation (as in Email to Support Ticket creation).
To know more about how to set-up the functionality out of the box, for a Sugar v18.104.22.168 (latest Sugar version while writing this article), please refer to this section of the manual.
Tailored to your Needs
Quite often it happens that customer needs are way beyond the simple round-robin case assignment within a set of people (Team) offered by the product.
For this reason I have decided to write some PHP code that would help companies out there, customise their Sugar record assignment to make it perfectly fit their business processes.
The three things I wanted to achieve with this customisation are:
- Customise Cases assignment rules
- Customise Email assignment rules
- Be able to notify the case owner that there is a new Email for an existing Case
Implementation and Setup
The code will add a new status on Cases called “Email Received”, and it will be used on the code to let the support team representative know that a new email has arrived.
The installable module will add two before_save logic hooks on the Emails module that allow to customise the assignment of the Cases and Emails to a specific Team and a specific User and finally change the status of a Case when there is a new email reply to a previous ticket.
Specifically for this example, all Cases and Emails will be assigned to the Admin user (with user id 1) and changed from a specific newly created Team “Inbound Cases” to the “Global” Team. Once a new Email arrives for a ticket already existing in the system, the Case status will be changed to “Email Received”. The Email will be assigned to the Global Team, and assigned to whoever is the owner of the Case by default.
With this customisation, users can setup dashlets on their home page specifically filtering for their own Cases, with status “Email Received” to know which ones are their active tickets. Additionally, if more immediate communication is required, a workflow can be setup to notify the user assigned as soon as a new email arrives.
The module has been tested on Sugar 6.5.17 and 22.214.171.124 of the Professional version, but any commercial version would work. The code can be tweaked to work with Sugar 6.5.x Community Edition as well, but that does not have Teams, therefore the behaviour will have to be changed slightly.
First of all we have to add a new (and empty) Team. In my scenario I’ve added “Inbound Cases”.
The next step is to setup a mailbox to create Cases and assign them Round-Robin to the empty Team just created (will not assign the case to anybody as no users are part of the Team).
Finally you will have to install the module provided at the bottom of this blog article, to your CRM system.
As mentioned previously, it is possible to tailor the solution further by adding a dashlet filtering on the user’s own Cases, with status “Email Received” to know which tickets need attention.
Additionally it is possible to setup a new workflow Email notification to alert the users of a new incoming Email for an existing Case. The workflow rules would look something like this: for existing records only, alert the Case’s assigned user when the status changes to “Email Received”.
On the code level, there are a couple of configuration variables to set:
- Which Case status to use when there is a new Email on the Case
- Which team Cases are assigned to by default
- Which team all routed records should be assigned to during the routing (most likely Global to make the support ticket globally visible within your CRM)
To completely tailor your Cases and Emails routing, you can change the methods “reopenCase” and “customCaseAssignment” to include your own rules.
You might want to go even one step further, way beyond simple record assignment and lookup other outstanding tickets related to the subject, or get the customer’s contract status, or even query external systems for additional data… I leave that up to you and your creativity!
You can find the full code and the installable Sugar zip package tested on versions PRO 6.5.17 and PRO 126.96.36.199 on this github repository.