Can I submit a Jotform to a non-jotform form handler / to some remote end point?

  • dmac
    Asked on April 10, 2015 at 3:06 PM

    I'm trying to use Jotforms as a front end to Saleforce Case management since thier forms are horrible.  Can I submit a Jotform so a salesforce.com form handler so it will create the "case" from the jotform fields?

     

    I would need something like:


    form action="https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST"


    input type=hidden name="orgid" value="00E3020000010xw1"


    input type=hidden name="retURL" value="http://www.vistaone.com/amx/helpisontheway"

     

     

  • BJoanna
    Replied on April 10, 2015 at 4:18 PM

    I'm not sure exactly what you are trying to do, but if you want to connect JotForm with Salesforce you can use Salesforce integration. To find out more how to do it please follow next guide:

    http://www.jotform.com/blog/54-Flexible-Data-Integration-with-Salesforce 

    In case that you want to send POST Data From JotForm Using PHP to some other page, please read this article:

    http://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page 

    Hope this will help. Let us know if you need further assistance. 

  • dmac
    Replied on May 1, 2015 at 11:43 AM

    Thank you for your recommendation.  I've been working on it but can't quite get it to work.

    To answer your point about not understanding exactly what I'm trying to do, let me elaborate.  Perhaps you can recommend a better way to do it.

    We use saleforce.com and it has a helpdesk case management capability.  They can provide an HTML form to include on our website that when filled out by an end user, opens a case in Saleforce.com with all the fields mapped to the appropriate saleforce.com fields.  That works fine, but the HTML forms they generate look horible so I was hoping to use jotforms instead.

    For starters, you mentioned your Saleforce.com integration.  However, it will not help here since 1) forms submitted through that integration are entered as contact record into Saleforce, not as a case record. And, 2) it requires a much higher subscription level with Salesforce.com than we are able to pay.

    So, what I'm trying to do is have the jotform submit to the Salesforce.com form handler that creates cases.  The article that was quotes shows the ability to send "post data" to a thank you page which seems to be on the right track.  If I choose the Salesforce.com form handler, it seems to work in that a case record is created, but then jotform displays an error on the screen instead indicating that there was a problem with the thankyou page instead of the thankyou page I setup in the Salerforce.com handler. Perhaps I can write a PHP page that will take the post data and submit it to salesforce and then display the thankyou page.  I'm so close!

  • Ben
    Replied on May 1, 2015 at 2:15 PM

    My colleague gave you good guides and they would be great to set up such things, but in your case, I would suggest setting up webhook instead.

    You can see here how to do that: How to Setup Webhook with JotForm

    What happens is that you basically send the data to that end point (webhook) and then it is up to you how you will handle the data, while in the same time your user is going its own way to the thank you page, or is redirected as you want them to be.

    This means that you do not need to worry about your users seeing any messages that they should not and if there would be any error along the way.

    Next to that, sending data to a webhook can be seen as one process and handling the user as another - allowing you to be able to troubleshoot everything on its own :)

    Do let us know how it goes.

  • dmac
    Replied on May 1, 2015 at 2:34 PM

    That Webhook sounds like it would work, but I had some new inspiration around your colleague's previous recommendations.  I was trying to set the Jotform "thank you" page to the Salesforce web-to-case form handler, which yielded an error.  Instead, I set the Jotform thank you page to a cobbled together PHP script from some things I found on the web.  The script takes the post data Jotform can optionally send (explained in your colleague's links) and reads that into an array, and then uses CURL to submit a new form to the Salesforce form handler, and finally displays a thank you message on the page. 

    For this to work, I had to manually rename all of the fields in my jotform so they matched up with what Saleforce was expecting (e.g. priority not field_47 etc.)  Also, I had to add some hidden fields just like the Salesforce form would have that included things like our account number, etc. 

    Here is the PHP script:

    <?php

    //read post data and prepare data for posting (key1=value1)
    foreach ( $_POST as $key => $value) {
        $post_items[] = $key . '=' . $value;
    }

    //create the final string to be posted using implode()
    $post_string = implode ('&', $post_items);

    //create cURL connection
    $curl_connection =
      curl_init('https://www.salesforce.com/servlet/servlet.WebToCase');

    //set options
    curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30);
    curl_setopt($curl_connection, CURLOPT_USERAGENT,
      "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
    curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1);

    //set data to be posted
    curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);

    //perform our request
    $result = curl_exec($curl_connection);

    //For troubleshooting, show information regarding the request
    //print_r(curl_getinfo($curl_connection));
    //echo curl_errno($curl_connection) . '-' .
    //                curl_error($curl_connection);

    //close the connection
    curl_close($curl_connection);

    ?>

    <html>
    <body>
    <table width="400" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>
    <div align="center">Thank You, Your Information Has Been Submitted</div>
    </td>
    </tr>
    </table>
    </body>
    </html>

     

     

     

     

  • Ben
    Replied on May 1, 2015 at 3:51 PM

    Great to hear that.Thank you for the update and for including the PHP code as well for others to be able to use it if needed :)