Alert or Process when an Email to or from a Contact using BCC to Sugar when the email address is not in Contacts Module?

We have an "automatic" BCC to our SugarOnDemand installation for all email sent by our Sales and Service Personnel.  We also have an automatic redirect of inbound email from the email server to some "generic" email addresses using the Sugar BCC address.  It works well to capture all the inbound emails to some "generic" addresses (like Sales and Service) and all outbound email from Sales Reps and Service Personnel.

I'm looking for a way to set an alert in the BPM when an email from a customer or prospect is received (or a sales reps outbound email) arrives to or from an email address that isn't in the Contacts Module.

I realize that the email module in Sugar is very limited (some of us would like to have it in Studio and more functionality in BPM)...

Does anyone have a suggestion?  Thanks. 

Parents
  • Hello Bud
    Unfortunately, you can't do this by BPM. Nevertheless, this can be done by adding a custom trigger on "new e-mail was saved."

    After an email is saved in Sugar DB, check FROM, TO, and CC addresses with contacts' e-mail addresses.

    If a new one is found, create a Contact based on an e-mail's domain. It presupposes to look for accounts based on the domain addresses. If an Account already exists, add a Contact to this Account and assign it to an Account's Assign_to user. Otherwise, create the only Contact and set it to a user by specific logic. As soon as a new Contact is assigned to a user, this user will receive a notification about this (standard Sugar functionality)

    We do very similar operations when processing a list of leads after a webinar. To make the looking for of accounts quicker, we added the new custom module Domains.

    Logic Builder can configure necessary logic without programming. It opens an opportunity to change business logic as quickly as you need it.

    I hope it helps you. If you need help, let me or know.

    Regards,
    Mykola

    Integroscrm.com
    We make work in Sugar
    more convenient and efficient

Reply
  • Hello Bud
    Unfortunately, you can't do this by BPM. Nevertheless, this can be done by adding a custom trigger on "new e-mail was saved."

    After an email is saved in Sugar DB, check FROM, TO, and CC addresses with contacts' e-mail addresses.

    If a new one is found, create a Contact based on an e-mail's domain. It presupposes to look for accounts based on the domain addresses. If an Account already exists, add a Contact to this Account and assign it to an Account's Assign_to user. Otherwise, create the only Contact and set it to a user by specific logic. As soon as a new Contact is assigned to a user, this user will receive a notification about this (standard Sugar functionality)

    We do very similar operations when processing a list of leads after a webinar. To make the looking for of accounts quicker, we added the new custom module Domains.

    Logic Builder can configure necessary logic without programming. It opens an opportunity to change business logic as quickly as you need it.

    I hope it helps you. If you need help, let me or know.

    Regards,
    Mykola

    Integroscrm.com
    We make work in Sugar
    more convenient and efficient

Children
  • @Mykola_Bulava has a good solution though I can see how one might not want to automatically create Accounts/Contacts/Prospects.


    If you don't want to automatically create Account and Contact records you could use Cases for the inbound email by assigning each of the bulk inbound email address to inbound email records related to your Sales and Service teams for processing and reassignment.

    The Case will be automatically related to that inbound Email so your Users can get to the context of the enquiry quickly and be able to create a Contact/Prospect if one does not already exist.

    The caveat with that is that Cases are assigned more or less randomly within the team. I have requested before that Sugar allow Cases to remain UNASSIGNED, by default, but this is not an option right now.

    One way around that, which is a bit of a pain, is to create a separate team for Inbound_Assignment with no one in it other than the SugarAdmin user. Associate the inbound_email records for your Bcc emails to that Team, then, in an on relate logic hook, if the Email is related to a Case that belongs to that Inbound_Assignment Team (and therefore assigned to SugarAdmin), re-assign the Case to the "From" user from your email record and change the Team on the Case to that User's primary Team. You user will now have an assigned Case for the email they received from the customer.

    As for the outbound emails, when an email record is created you can have a logic hook that verifies whether that email is outbound and has a To address that is related to a Contact/Prospect (check the email_addr_bean_rel table) if not, then look up the From address for that email by email_id in emails_email_addr_rel and see who sent it, it should be your user. You can then use MailerFactory to send an email to your user and notify them that they sent to an address not in Sugar and they should add a Contact/Prospect. Because you have access to the original email they sent you can include a link to that Email in Sugar and/or include some content in your mailer to give them an indication of which outbound email triggered the alert.

    https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.0/Architecture/Email/Mailer_Factory/

    If you don't want to send immediate notification, and/or you want to remind people that they have outstanding contacts/prospects to add, you could have a custom scheduler at the end of the day that looks up all the orphan email addresses in outbound emails (emails.type = 'out'), tracks down the senders using the corresponding entries in the emails_email_addr_rel table and notifies them, again using the MailerFactory, with a list of emails they sent for which no recipient Contact/Prospect record exists (checking email_addr_bean_rel). Include the subject line of their original email, and the To address, in your notification so the user can quickly see what they were about and add those Contact/Prospect records.

    You could do a similar check for Cases that may remain unlinked to Contacts/Prospects.

    The scheduler could become nagging after a while if you keep telling them about the same addresses and they keep ignoring them, but that might be just what you need to get them to add the Contact/Prospect record since once they do they won't have that notification again.

    You could even add a notification to the manager of users who have outstanding records to create for more than x-days/weeks.

    Alternatively you could decide to put a limit on your notification period: if the customer has not responded to the email, and the user has not added a Contact/Prospect for more than x days, then maybe you shouldn't add a record at all... so you just ignore it.

    I hope this gives you some ideas/options,

    FrancescaS

  • Thanks Mykola,

    I've been looking at the Logic Builder in relation to other things I'd like to accomplish but we're not ready to make that investment.

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)