Connecting your Contact Form to CRM

Here's how to set up a contact form that will auto-populate your CRM, powered by TwentyTen CRM.

It took a bit of work, but a few months ago I finally figured out a way to connect my contact form to my CRM. Here's the tools you'll need:

Build the form

Using Gravity Forms, create a contact form with all the relevant fields you want to collect. Out of the box, GF let's you create simple posts using your form. Using the GF + CPT plugin, you'll be able to link the fields to meta and taxonomy fields. Here's the fields I'm using in my form :

  • Your Name = Post Title. This field also has all the extra post data on it. I'm publishing it as a Draft post (I publish it once I've responded) in the "Prospect" category.
  • Your Email = Post Meta field for email (_crm_client_email).
  • Your Phone = Post Meta field for phone (_crm_client_phone)
  • URL = Post Meta field for url (_crm_client_url)
  • How did you find me = dropdown populated by the Source taxonomy
  • Message = Post Body
  • [Hidden] Sales Status = Post Meta for ( _crm_sales_status) setting it to Inquiry
  • [Hidden] Inquiry Date = Post Meta for ( _crm_date_inquiry ) setting it to current date

I wasn't able to have a hidden field that sets the value of a taxonomy, so I added this to my functions.php file in TwentyTen CRM to set a default value. If you don't specify a value for the Point of Contact taxonomy, it sets it to "Email Form" when you publish the post (thanks Michael Fields ).

Create Contact Page in CRM

Once you've created your form, it's time to create a contact page. Go to Pages > Add New, create a page called Contact, then add the appropriate shortcode to it to add the form.

But we want the contact page on our website, not on our CRM. Let's strip this page bare so we can embed it to your actual site as an iFrame.

I created a very simple page template in a file called template-form.php (for TwentyTen CRM) and template-new-form.php (for Genesis CRM) which strips out the elements I don't want.

Make the Contact Page Accessible

So now we have a functioning (and bare) contact form page that looks something like this . If you'd like, add some CSS to style it to match your actual site, like this .

But because we have the Registered Users Only plugin, only logged in users can access the form. Luckily the plugin provides us a filter to specify certain pages that are open to everyone.

Use this code in your functions.php file to make the form page accessible. Change 'form' to whatever the page slug of your contact page is (mine is 'form').

Finally, Add the Contact Form to Website

On your public website, create a contact page and embed the CRM contact form as an iFrame. Here's what my embed code looks like .


Now you'll have a contact form that will auto-populate your CRM with the contact's information. They'll show up as Drafts, and you can click "Publish" once you've responded. This was hugely helpful for me on my recent trip .

No comments yet