Note that there are some explanatory texts on larger screens.

plurals
  1. PONetSuite - Accept webhook POST data to create record using ASP.NET or PHP
    primarykey
    data
    text
    <p>We have a lead generation form at Unbounce.com that is capturing lead data. They have a webhook that can transmit the data via POST to any URL that can accept it and process it. We would like to build a page that accepts this data and processes it in NetSuite (probably via the SuiteScript API's, but not sure). <a href="http://www.netsuite.com/portal/developers/resources/APIs/Dynamic%20HTML/SuiteScriptAPI/MS_SuiteScriptAPI_WebWorks.1.1.html" rel="nofollow">http://www.netsuite.com/portal/developers/resources/APIs/Dynamic%20HTML/SuiteScriptAPI/MS_SuiteScriptAPI_WebWorks.1.1.html</a> </p> <p>Variables To Get From POST The following variables will be passed from the form in this order to the NetSuite processing page:</p> <pre><code>prog first_name last_name email parents_email i_am_a_ phone_number parents_phone_number comment </code></pre> <p>Additional Page Variables To Attempt To Grab Reading the example code below it looks like we can grab and store a few additional items. If so it would be good to store them in the CRM in the visitors profile for future reference:</p> <pre><code>page_id page_url variant </code></pre> <p>REQUEST FOR SAMPLE CODE Since our preferred development enviornment is ASP.NET, can you provide sample code that can accept POST data from a webhook and create a new CRM record within our NetSuite account?</p> <p>SAMPLE PHP CODE TO GET DATA FROM POST Example code can be found at <a href="http://support.unbounce.com/entries/307685-how-does-the-form-webhook-work" rel="nofollow">http://support.unbounce.com/entries/307685-how-does-the-form-webhook-work</a></p> <p>If this were a PHP page you would grab the variables in the following fashion:</p> <pre><code>// This is a sample PHP script that demonstrates accepting a POST from the // Unbounce form submission webhook, and then sending an email notification. function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; } // First, grab the form data. Some things to note: // 1. PHP replaces the '.' in 'data.json' with an underscore. // 2. Your fields names will appear in the JSON data in all lower-case, // with underscores for spaces. // 3. We need to handle the case where PHP's 'magic_quotes_gpc' option // is enabled and automatically escapes quotation marks. if (get_magic_quotes_gpc()) { $unescaped_post_data = stripslashes_deep($_POST); } else { $unescaped_post_data = $_POST; } $form_data = json_decode($unescaped_post_data['data_json']); // If your form data has an 'Email Address' field, here's how you extract it: $email_address = $form_data-&gt;email_address[0]; // Grab the remaining page data... $page_id = $_POST['page_id']; $page_url = $_POST['page_url']; $variant = $_POST['variant']; </code></pre> <hr> <p>However I don't know the code to use to get it into NetSuite. After reviewing the SuiteScript API from NetSuite it looks like we should be using nlobjRequest or nlapiRequestURL, but I have zero knowledge on how to integrate this with the sample PHP page above. </p> <p>Thanks for all your help for a NetSuite noob.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload