The goal of the project is to assign emails to an existing "Notification" case.
SugarCRM or SuiteCRM rely on email subject containing "[CASE:%1]" where %1 is the case number, to associate incoming emails to a case.
We don't have control over email notifications from companies (i.e. facebook, twitter, hosting companies, etc); therefore, I want to assign all incoming notifications under the respective Account case.
This can be accomplished by hooking into handleCreateCase() method and modify the email subject via following psudo code:
class SleCustomInboundEmail extends InboundEmail {
function handleCreateCase($email, $userId) {
If email_subject not start with [CASE:%1] /* email doesn't have macro */
&& ($acc = getAccount( $email_from) != null) /* account with same email exists */
&& ($c = [login to view URL]("Notification") /* Notification case exists for the account */)
/* We update the subject to include the found caseId - $aCase->getEmailSubjectMacro() */
$[login to view URL] = "[CASES:" + $[login to view URL] +"]" . [login to view URL]
}
parent::handleCreateCase($email, $userId)
}
linux grep reveals two classes that have handleCreatecase methods:
./modules/InboundEmail/[login to view URL]:
./modules/InboundEmail/[login to view URL]:
Your task is to write a bean ([login to view URL]) so that this is upgrade safe.
Resources:
[login to view URL]
[login to view URL]