Skip to main content

Automate Incoming Lead Routing

Automate routing of inbound ADF emails to assign the correct Location and Lead Type.

Inbound Lead Routing

Automotive marketing services often use ADF formatted email to transmit lead data into a dealer's CRM system. To receive this lead data we set up Email Addresses which are part of an Email Service. The Email Service processes all messages received and assigns them a Lead Type and Location. This article will explain how to set up the Email Service, Email Service Addresses and Intercompany Lead Routing entries. 

Intercompany Lead Routing entries are custom settings that directs each message received to the appropriate Location (including queue) and Lead Type. Each routing entry has a corresponding Email Address in the Email Service. For example, Finance leads for the San Francisco store would get an lntercompany Lead Routing entry and a related Email Address. 

Create the Email Service

Enter the Setup Menu and then search for Email Services in the quick find box. If there is already an email service there that uses the EmailADFHandler Apex Class then click the Edit link next to it. Otherwise, click the New Email Service button.

Field Value
Email Service Name The Email Service can have any name though it should be descriptive enough to understand such as "Inbound ADF Emails".
Apex Class Choose EmailADFHandler.
Accept Attachments None
Advanced Email Security Settings Uncheck
Accept Email From Leave blank unless you want to restrict the senders who may submit leads to any email address on this Email Service.
Convert Text Attachments to Binary Attachments Uncheck
Active This service won't work until the Active box is checked.
Over Email Rate Limit Action This is for when too many messages get sent in a specific timeframe. Generally Requeue though you could choose to Discard.
Deactivated Email Address Action If the email address within an Email Service has been deactivated. Generally Discard.
Deactivated Email Service Action If the Email Service has been deactivated. Generally Discard.
Unauthenticated Sender Action Only applies if the Advanced Email Security Settings is checked. Generally Discard.
Unauthorized Sender Action Only applies if the Accept Email From box has values. Generally Discard.
Enable Error Routing If you would like errors sent to DealerTeam or your internal IT team check this box.
Route Error Emails to This Email Address If sending to DealerTeam populate with or the email address if your IT team.

Get more information on setting up Email Services from Salesforce 

Email Service Address

Set up email addresses by clicking the New Email Address button from the related list of the Email Service.

Field Value
Email Address Name Name of the record for your reference.
Email Address Enter the local part of the email address (the part before the "@") and the domain name part will get assigned automatically.
Active This email address won't be able to receive messages if this isn't marked true.
Context User When the automation in the Email Service is run this is the user that it will process as.
Accept Email From Leave blank unless you want to restrict the senders who may submit leads to this email address.
NOTE: the automatically generated email addresses are quite long and difficult. If you would like a shortened email address for sharing please open a case and provide the full email address. We'll provide a similar address with an domain.

Email Address Setup.png

Intercompany Lead Routing

Enter Custom Settings into the Quick Find box in the Setup screen and click the link. Then find the Intercompany Lead Routing entry titled XXX and click the Manage link.

Field Value
Name Something meaningful such as the email address used for this entry.
Company Number The Company Number of the Location assigned to the Sales Up that gets created.
Lead Type The value of the Lead Type field on the Sales Up that gets created.
Local Name The same value as the Email Address field from the Email Service Address record (just the part before the "@").
RoutedEmail The email address that the message was sent to. This will either be the full Email Service Address or a shortened email address that forwards.
NOTE: If you want to assign these newly created Sales Ups to a queue assign it on the Location object.

Intercompany Lead Routing Custom Setting.png

Learn More About ADF

Learn more about how to format Auto-lead Data Format (ADF) messages.