31 Jul’15

Dynamics CRMWordPress Gravity Form – Microsoft CRM Integration (WordPress End)

This blog is about integration of Gravity Form plugin with the Microsoft Dynamics CRM. This part contains the WordPress end implementation.

Gravity Forms is an advanced contact form plugin for WordPress powered websites and is used by millions of sites. Gravity form simply allows you to select your fields, configure your options and easily embed forms on your site using the built-in tools.

We will implement Gravity form on website so that the values submitted in it will directly go to CRM as lead.


  1. Firstly, install the Gravity form, which you can purchase depending on your requirement. [Link : http://www.gravityforms.com/purchase-gravity-forms/]
  2. Set up your fields as per your requirement and note the field ID. Also call the form wherever you want to use (page editor or php template or widget).
  3. gravity-form

  4. Now, you have to use the Gravity Form’s gform_after_submission function along with the field ID’s to pass the parameters.
  5. Once you are done with the form implementation, next step is to write code for passing the parameters in functions.php file of current theme.
    add_action( 'gform_after_submission', 'post_to_third_party', 10, 2 );
    function post_to_third_party( $entry, $form ) {   
        $post_url = 'http://thirdparty.com';
        $body = array(
            'first_name' => rgar( $entry, '1.3' ), 
            'last_name' => rgar( $entry, '1.6' ), 
            'message' => rgar( $entry, '3' ),
        $request = new WP_Http();
        $response = $request->post( $post_url, array( 'body' => $body ) );    

    post_url = URL of the page where your web service is written/called.

    first_name (or last_name or message) = Name of parameters used in web service where values will be stored. You can create any number of fields and pass their values.

    ($entry, ‘3’) = Here 3 is the id of the field in gravity form, whose value will be passed in the ‘message’ parameter. For name, we have two ID’s as it has first name and second name fields.

    gform_after_submission = Function executed at the end of the form submission process (after form validation, notification, and entry creation). If you want to implement this for any particular form, then you can use “gform_after_submission_FORM-ID” like gform_after_submission_2.

  6. Now the values of the fields filled in Gravity Form will be passed to web service and then it will be stored as Lead in CRM. We recommend you to use captcha with form to avoid spam entries in CRM.



Written by

Team Member


Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.

Want to streamline your business processes?

  • This field is for validation purposes and should be left unchanged.

Recent Articles

  • Managing mailbox through Email Archiving

    20 March’ 2018

    Introduction: Email can fill your Outlook Inbox quickly – new messages, replies, and forwards. Before you know it, yo...

    Read more
  • Workaround to Report.SAVEASPDF in NAV 2018

    20 March’ 2018

    Objective: In NAV 2017 Emailing the PDF by running the report using Report.SAVEASPDF is now not allowed in NAV 2018. Th...

    Read more
  • Dynamics 365 Client Diagnostics

    15 March’ 2018

    Main cause of Performance Issues: Bandwidth and latency are the primary characteristics which affects the performance o...

    Read more
  • Closing Blind Shift in MPOS and CPOS in Dynamics 365 for Retail

    15 March’ 2018

    Manual For closing Blind shift in POS: Blind shifts terminate the currently ongoing shift and when logged in a new shif...

    Read more
  • Persistent Filters in the Power BI Service

    13 March’ 2018

    Introduction: The feature is finally release, and it is power BI has announced general availability of persistent filt...

    Read more