Web to Case using Google Forms and Salesforce Email to Case

1:24 PM

Web to Case is available out-of-the box under Setup -> Customize -> Self Service -> Web to Case. This article is only intended to give you an understanding of Google forms and workflow rules on the "Email Message" object as well as one way of sending information to Salesforce from the google platform.

STEP 1:

You should be having a google Account. Click on the "Documents" link when you are in gmail. You can find it at the top bar as shown below.


STEP 2:

Create a new form as shown below.

STEP 3:

A sample form creation screen is shown below













Click the "Save" button to save the form.

STEP 4:

Now go back to your "Documents" tab as shown in STEP 1. You will now see a document named "Web to Case Form" and clicking on it would open up a spreadsheet as shown below.




GETTING TO THE SALESFORCE PART:

STEP 5:

Create a new Email to Case address as shown below and make a note of the Email Service Address.






STEP 6:

We will now create a workflow rule to update the CASE field PRIORITY with the value entered in the google form. Go ahead and create a workflow rule on the "Email Message" object.




NOTE: The entry criteria will be Email Message : Text Body contains "What is the severity :: High"

STEP 7:

Let's get back to google now. Open the document as shown in STEP 4.

Click on the "Tools" menu and select "Script Editor". Paste the following code in the editor window.

function sendFormByEmail(e)
{
  // Remember to replace XYZ with your own email address
 
  var email = "XYZ"; 
 
  // Optional but change the following variable
  // to have a custom subject for Google Docs emails
 
  var subject = "Google Docs Form Submitted";  
 
  // The variable e holds all the form values in an array.
  // Loop through the array and append values to the body.
 
  var message = "";
  for(var field in e.namedValues) {
    message += field + ' :: '
               + e.namedValues[field].toString() + "\n\n";
  }    
  MailApp.sendEmail(email, subject, message); 
}

Replace the value "XYZ" in the email variable with the "Email Service Address" that you noted down in STEP 5.

Go to "File" menu and select "Save". Give in some name and save the file.

Now, go to "Resources" menu and select "Current Script's Trigger" as shown below and save the changes.



STEP 8:

Now, go to your Google form. Select the Priority as "High" and submit the form. Your Case is created in Salesforce and the Priority is updated as "High".






4 comments

  1. Nice. Simple and easy. Works great.

    ReplyDelete
  2. My Description field in google form is not mapping to Case. How can I fix that.

    ReplyDelete
  3. Is there any way that SFDC will recognize the email of the person who filled in the form and relate the case to this contact? Now every new entry is related to the email-to-case email. Thanks a lot!

    ReplyDelete
  4. 👍 This tutorial on using 📝Google Forms and 📧Salesforce Email to Case is 🔝! The step-by-step instructions are easy to follow and make implementation a breeze. Thanks for sharing! 🙌

    ReplyDelete