Automate Salesforce Email Follow-up

CData Arc links your cloud-based CRM and email accounts together seamlessly. This functionality makes it easy to automate manual tasks such as sending an email whenever a new Lead is created in Salesforce. The following sample project demonstrates how different ports in CData Arc are used to automatically take information about Salesforce Leads and send a templated email.

Drop in the Sample Project

To get started with the sample, download and install CData Arc (free 30-day trial). Then, download the sample project and extract and copy the contents to the "data" folder in the installation location for CData Arc. For Windows installations, this is likely C:\Program Files\CData Arc. Please consult the documentation for the Java build of CData Arc for Linux/Unix/Mac installations.

Poll Salesforce for New Leads

The Salesforce Connector (SF_LEADS) pulls Salesforce entities into CData Arc.

Connect to Salesforce

Configure the username, password, and security token fields in the Salesforce Connector Settings tab.

Configure the Query

The Salesforce Connector is configured with a default output template for the Salesforce Lead table. This template is configured to poll Salesforce for new Leads that have been added to Salesforce since a pre-determined date and time. The application generates a single XML file for all of the processed Leads in Salesforce (Set the BatchResults advanced setting for the connector to 'true.'). Open the template file in order to view the logic controlling the query. Set the skipProcessedRows attribute to 'true' in order to prevent the application from pulling in data that has been previously retrieved. Additionally, add a WHERE clause to the selectQuery attribute in order to limit the query to retrieve data modified since the specified date.

Run the Query

Click the run symbol next to an individual template in order to run that specific query, or click the run symbol in the Output Templates window in order to run all of them in succession. The connector has already been configured to poll the Salesforce account on a scheduled interval, which is seen in the Settings tab under the Automation Settings section.

Once the connector has retrieved the Lead data, the results are sent to the EmailSend Connector.

Send Emails Based on Lead Data

The EmailSend Connector (EMAIL_LEADS) sends emails (raw or using templates based on received data) via SMTP.

Connect to the Email Account

Enter the email server, connector, username, and password and click Test Connection.

Configure the Email

You can customize emails sent based on the data found in the files added to the Send folder. Consider the following XML document (an abbreviated sample Salesforce Lead):

  <Company>ABC, Inc.</Company>
  <Email>[email protected]</Email>
  <ProductInterest__c>Blue Widget</ProductInterest__c>

You can access the elements in the XML using XPath notation. For example, to use the value of the Company element in the email template, write [document.Lead:Company]. For this sample, we use the following template:

Hi [document.Lead:FirstName],

I see that you are interested in [document.Lead:ProductInterest__c]. Would you like to set up a demo to learn more about how [document.Lead:ProductInterest_c] can help you with your work at [document.Lead:Company]?

CData Arc User

The template dynamically reads the FirstName, ProductInterest__c, and Company fields and populates the email body. You can also reference the Email element for use in the To setting in the SMTP Message. The EmailSend Connector sends an email to each Lead in the Send folder (retrieved using the Salesforce Leads folder).

Just like with the Salesforce Connector, this connector has already been configured to automatically process new files added to the Send folder. View these options in the Settings tab under the Automation Settings section. You can also send files manually. On the Send tab, select unsent files and click the Send button to process the file.

More Information & Next Steps

As you can see, CData Arc makes it possible to automate your CRM and email accounts, automatically sending emails based on new Salesforce leads. For more information on CData Arc, visit our home page. Download your free, 30-day trial and start controlling your business document exchange today!

Download & Install Sample

Already running CData Arc? This sample will setup CData Arc with the data and connector configurations referenced in this article: