Skip to main content




Automate Incoming 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.

After reading this article you will be able to

  • Navigate to Setup
  • Create the Email Service
  • Setup Email Addresses
  • Setup Intercompany Lead Routing entries


Step One: Navigate to Setup Menu

1. Click the gear icon

2. Click Setup

1.1 1.2.png


Step Two: Create the Email Service

1. Type Email Services in the quick find box.

2. Click the Email Services  

Note: If there is already an email service there that uses the EmailADFHandler Apex Class then click the Edit link next to it.


3. Click the New Email Service button.

2.1 2.2 2.3.png


4. Type a name in the Email Service Name field

5. Type EmailADFHandler in the Apex Class fields and click the lookup icon

6. Click EmailADFHandler link

2.4 2.5 2.6.png


7. Check Active checkbox

8. Check Enable Error Routing checkbox

9. Type the email address to send errors to in the Route Error Emails to This Email Address field

10. Click Save

2.7 2.8 2.9 2.10.png


Note: Get more information on setting up Email Services from Salesforce 


Step Three: Email Service Address

1. Click the New Email Address button from the Email Addresses section of the Email Service details screen



2. Fill in the Required fields

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: Must be active to receive messages.

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.


3. Click Save

3.2 3.3.png


Note: If you would like a shortened email address for sharing open a case and provide the full email address. We can provide a similar address with an domain.


Step Four: Intercompany Lead Routing

Intercompany Lead Routing entries are custom settings that direct 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 Intercompany Lead Routing entry and a related Email Address. 

1.Type Custom Settings into the Quick Find box in the Setup screen

2. Click the Custom Settings link.

3. Find the Intercompany Lead Routing entry and click the Manage link.

4.1 4.2 4.3.png


4. Click New



5. Fill in required fields

Name: A descriptive title.

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.


6.Click Save

4.5 4.6.png



NOTE: If you want to assign these newly created Sales Ups to a queue assign it on the Location object.


Learn More About ADF

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