Salesforce

Salesforce Gmail Integration

Sending emails through the Gmail API to the Salesforce contact persons is possible by integrating Salesforce with Gmail. For example, if the status of the case is updated or a new record is inserted into Salesforce, it is necessary to know the contact person/admin through social media messaging applications like Gmail/Outlook, etc. In this guide, we will discuss how to integrate Salesforce with Gmail to send emails when the Salesforce record is inserted/updated. Also, we will integrate Gmail with Salesforce to create cases in Salesforce when the custom raises new case through Gmail.

Integrating Salesforce with Gmail

In this scenario, we will see how to send email to the contact person when the Salesforce record is created or updated.

Zapier

Zapier is a product which is used to allow the end users to integrate the web applications that they use and automate it quickly and accurately. It connects nearly 5000+ apps. Using Zapier is free and simple. No coding is required. We just need one Salesforce account and a Gmail account.

Example 1: Send the Gmail Emails for Updated Salesforce Records

In this example, we send an email to the contact person and case person when a case record is updated/modified.

Quickly go to the following link and choose “Send Gmail emails for updated Salesforce records” by clicking the “Try it” button:

https://zapier.com/apps/gmail/integrations/salesforce

Trigger Component:

1. Account: Add the Salesforce account. Allow Zapier to your Salesforce account and click on “Continue”.
2. Trigger: It will ask the Salesforce object to choose. We need to send an email when the case record is updated. So, “Case” has to be selected. Then, click on “Continue”.

3 .Test: Choose any case existing record to test this trigger. Continue with the selected record.

Action Component:

1. Account: Add your Gmail account. Allow Zapier to your Gmail account and click on “Continue”.
2. Action: Here, we need to prepare the email template that includes subject, to, bcc, description, etc. Let’s look at the following image that includes the case fields that are included in the email template.

3. Test: Check the email template and publish your Zap.

Let’s go to Salesforce Org and update the following case status to “Working”.

You should receive an email with the following details. Go to your Gmail application and refresh the Inbox.

Example 2: Send Emails through Gmail with the New Salesforce Accounts

In this example, we send an email to a person with account details whenever an account is created in Salesforce.

As part of this example, create the “Account Email” field on the account object with the data type as “Email”.

Go to Zapier and select the following Zap:

Trigger Component:

1. Account: Add the Salesforce account. Allow Zapier to your Salesforce account and click on “Continue”.
2. Trigger: It asks the Salesforce object to choose. In this case, an email has to be sent when an account is created in Salesforce. So, “Account” has to be selected. Then, click on “Continue”.

3. Test: Test the trigger by selecting the existing record.

Action Component:

1. Account: Add your Gmail account. Allow Zapier to your Gmail account and click on “Continue”.
2. Action: Here, we need to prepare the email template that includes subject, to, bcc, description, etc. Let’s look at the following image that includes the account fields that are included in the email template.

4. Finally, test the action and publish the Zap.

Let’s go to the Salesforce “Accounts” tab and create one account with the previous details and check on Gmail.

We can see that the mail is sent to a specified account email and with all the details that are specified in the Zap action.

Integrating Gmail with Salesforce

Until now, we have seen how to send emails that are related to Salesforce data using Gmail integration. In this scenario, we will see how to load the Salesforce records from the Gmail application. Mostly, this application is used when the client raises a case in Gmail.

Example: Create Salesforce Cases for the New Emails Received on Gmail

If your customer/client finds an issue with your product, he will reach out to you via Gmail. Then, you need to store this as a case in your Salesforce application by creating one record in the case object. This is a manual task that takes more time and is not feasible. By integrating Gmail with Salesforce, you can directly load the record into Salesforce. Here, we also utilize Zapier to integrate Gmail with Salesforce and implementing this scenario.

Assume that “171fa07058” is a customer who logged a case related to Laptop issue. It is sent to our mail.

Now, we load this case into the Salesforce case object by integrating Gmail with Salesforce.

Trigger Part:

1. Account: Connect to your Gmail account by allowing Zapier to your Gmail.
2. Trigger: Specify the Mailbox as INBOX and click on “Continue”.

3. Test: Test with the existing record by selecting the email that is sent by the customer.

Action Part:

  1. Account: Connect to your Salesforce account by allowing Zapier to your Salesforce Org.
  2. Trigger: Specify the trigger as INBOX and click on “Continue”.

3. Action: Here, we have to map the email template with case fields.

4. Test the action and publish the Zap.

Now, go to the “Cases” tab in your Salesforce Org. We can see that the case is created with the mapped details.

Conclusion

We learned how to integrate Salesforce into Gmail and vice versa with examples. Basically, we integrate Salesforce with email to send the emails when the records are created/updated in Salesforce like informing the customer directly through email after creating an account/lead, etc. If you log a case in Salesforce through Gmail, you need to integrate Gmail with Salesforce. Both scenarios utilized the Zapier integration tool.

About the author

Gottumukkala Sravan Kumar

B tech-hon's in Information Technology; Known programming languages - Python, R , PHP MySQL; Published 500+ articles on computer science domain