A primer on the Process

For the uninitiated, the Email Service in Salesforce is an automated Process that strips content bodies, subtext, headers, and attachments from inbound emails for Object creation.

You could go about tieing each Email Service Process to Salesforce-created email addresses meant to receive messages for processing from users of a service.

Alternatively though, to give multiple users access to a service you could associate a single Salesforce email to an Email Service and write a class in Apex to execute differently for each user.

A common use case

As an example, you could write Apex Classes to identify users based-off of their email addresses and create Records accordingly.

Let’s talk Governor Limits

As is often the case with email capabilities, there’re Governor Limits to keep in mind. Here’s a list of them:

  • An email service only processes messages it receives at one of its addresses.
  • Salesforce limits the total number of messages for all email services combined for daily processing, including On-Demand Email-to-Case. Messages exceeding this limit are bounced, discarded, or queued for processing the next day, depending on how you configure the failure response settings for each Email Service.
  • Salesforce calculates the limit by multiplying the number of user licenses by 1,000 and caps out at 1,000,000. For example, if you have 10 licenses, your Org can process up to 10,000 email messages a day.
  • Email Service addresses created in your sandbox can’t be copied to your production Org.
  • For each Email Service, you can tell Salesforce to send error email messages to a specified address instead of the sender’s email address.
  • Email Services reject email messages and notify the sender of the email(comprised of combined body text, body HTML and attachments that extend approximately 10 MB depending on language and character set).
  • Now that you’re a bit more familiar, here is some syntax for you to look at. First of these – is the Email Service.

General syntax for Email Service class in Salesforce

Some more syntax

For our example, we start with the premise that each email’s subject and body contain no more than the words “Create Contact” and the Contact’s name(in that order). Then, in the likeness of an everyday enterprise scenario, we process subject lines to create new Contacts in Salesforce and extract Contact Names from the email body. Attachments come up under the Contact object in sales. In the following sections, you’ll find code implementations and test classes( 75% coverage) for the same.

Apex Class:-

Test Class:-

Defining Email Services with our Apex Class

After creating the above Apex Class, within your instance, go to

<Your Name> | Setup | Develop | Email Services.

Once there,

  • Click New Email Service to define a new Email Service.

Select the Apex Class we just created above, add the email address from where to accept the request and activate the Service as shown below:

After filling out the information, click Save and New Email Address

Next, click Save. This should throw up an email address as shown below.

Note: The domain name in the Email Address must qualify the one entered at Email Service in the first step. For instance, we’ve entered “gmail.com” in the first step, which means it will accept the email address only from gmail.com like the one in the email we just saw.

Finally, once the email address is generated by Salesforce, send the email to that address with the subject line “Create Contact” and a Contact Name as the email body to see if everything checks out.

Conclusion

The codebase here lets you extract data from emails for creating Contacts in your Salesforce Org that could be used to service Contacts from a business account in case of multiple users, especially for helpdesk operations or pushing updates and notifications. You could just as well extend this to build on stores for other objects. For any further assistance with Email feature sets or data extraction solutions for the Salesforce platform, don’t wait to reach out to us at sales@hicglobalsolutions.com

Related Articles
How to Use Transform Element in Salesforce Flow

Salesforce introduced the transform element in their winter ‘24 release. This feature simplifies data processing in flows by eliminating the need for loops and assignment elements. With the Transform Element, you can seamlessly map source data to target data, making your flows more efficient and easier to maintain. Transform element is available for screen flows, […]

Read More
How to Use TypeScript in Salesforce Lightning Web Components (LWC)

TypeScript is a programming language developed by Microsoft; used for enhancing JavaScript by adding different static types. With the help of TypeScript, developers can easily find errors during the development process before the execution. It also makes the code more readable and maintainable. With the successful integration of Salesforce Lightning Web Components (LWC), TypeScript improves […]

Read More
Expert Guide on Seamless Integration of Salesforce and QuickBooks Online

Integrating Salesforce with QuickBooks Online can significantly streamline your business operations, improving data accuracy and efficiency. QB Sync Made Easy offers a seamless solution to synchronize customer and financial data between the two platforms. This expert QuickBooks Online, on the other hand, is a leading accounting tool specifically developed for small and medium-sized businesses that […]

Read More
A Complete Guide to Salesforce CPQ Contract Amendment and Renewal

Salesforce CPQ software offers robust features for managing pricing, product configurations, and quotations. The capacity to effectively modify and renew contracts is essential for businesses managing intricate agreements and long-term partnerships. In this guide, we’ll walk you through the details of contract amendment and renewal processes in Salesforce CPQ. About Salesforce CPQ Contract Amendments Modifications […]

Read More
Step by Step Guide to Configure Email to Salesforce 1 1

In this detailed guide, we will walk you through the significant yet easy steps to configure Email to Salesforce. Without any further ado, let’s get started! About Email to Salesforce As the term refers, Email to Salesforce is valuable for any organization that businesses use as their Customer Relationship Management (CRM) platform. It helps streamline […]

Read More
Guide on CRUD Operations in Node.js with jsForce

CRM developers typically need to integrate Salesforce with Node.js apps. One well-known library for this purpose is jsForce, which provides a comprehensive set of tools for interacting with Salesforce data and performing CRUD tasks effectively. Let’s dive into the blog, where you will understand the use of jsForce to execute key CRUD tasks within Salesforce, […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
43 Lafferty Lane, Richmond Hill, L4C 3N8, CA +1(262) 310-7818