Netsuite allows you to create a Custom Record to store a table of data collected from an external form. For example, you may create an email opt-in form on your external website, and submit the form to Netsuite. The submitted data will be processed by a Suitelet, and stored as a Custom Record in Netsuite. The form must be able to process concurrent users, and hence Suitelet is favored over SuiteTalk (Web Service). NetSuite web service has a concurrency problem, so SuiteTalk should not be used in this type of scenario.

Let's assume that we are going to collect the Name and Email address of a user on the opt-in form, and they will be stored in the "Optin" Custom Record. The form elements ("name" and "email") have to be mapped as custom fields in the "Optin" custom record.

1. Login to Netsuite as an administrator.

2. Create a Custom Record by choosing Setup -> Customization -> Record Types -> New.

    Name: Optin
    ID: customrecord_optin

3. Create two custom fields for the "Optin" custom record.

NetSuite Custom Fields

    Name: Name
    ID: custrecord_optin_name
    Type: Free-Form Text
    Store Value = checked

    Name: Email
    ID: custrecord_optin_email
    Type: Email Address
    Store Value = checked

Once a custom record and custom fields have been created in the NetSuite, form data can be posted to Netsuite for insertion.

Searching on Custom Records

Now that we have a custom record created, we will discuss how to search for a custom field within a custom record. Here is an example of how to search an email address from the custom record we created above.

var email = "john.doe@webtrafficexchange.com";

var filters = new Array();
filters[0] = new nlobjSearchFilter('custrecord_optin_email', null, 'is', email);

var columns = new Array();
columns[0] = new nlobjSearchColumn( 'custrecord_optin_name' );

var results = nlapiSearchRecord( 'customrecord_optin', null, filters, columns );
if (results != null) {
    // We are expecting one record if any has been retrieved.
    var result = results[0];
    var name = result.getValue('custrecord_optin_name');
}

Share this post

Comments (0)

    No comment

Leave a comment

All comments are moderated. Spammy and bot submitted comments are deleted. Please submit the comments that are helpful to others, and we'll approve your comments. A comment that includes outbound link will only be approved if the content is relevant to the topic, and has some value to our readers.


Login To Post Comment