• : 1-877-596-8218
  • : sales@aecc.ca
# # #

How to implement a custom HTML (with integrated javascript) that uses restlet to get data.

To implement a custom html page in NetSuite you need to go through the following steps:

1) Create an HTML page with integrated javascript code:

The code above shows the structure of the HTML page. Here we use AngularJS framework to communicate with the server restlet api. We use $http service to extract JSON data from the server using the url that was provided to us by NetSuite when we create the restlet. To add this HTML page to the NetSuite go to Documents -> Files -> File Cabinet. Then click on SuiteScripts and AddFile.

After the file was saved it can be accessed using generated url:

2) Create restlet file. This file will contain the main logic of the application as well as provide the API to our client side javascript code.
Example of the restlet can be found here:

function suitelet_aecc_example_app(dataIn) {
    var data = getData();
    return JSON.stringify(data);
function getData() {
    function modifyFilters(assocArray) {
        var result = [];
        for ( var key in assocArray) {
        return result;
    var filters = [];
    var columns = {};
    columns["internalid"] = new nlobjSearchColumn('internalid');
    columns["companyname"] = new nlobjSearchColumn('companyname');
    filters.push(new nlobjSearchFilter('stage', null, 'is', 'CUSTOMER'));

    var data = (nlapiSearchRecord("customer", null, filters, modifyFilters(columns)) || []).map(function(rec) {
        var internalId = rec.getValue(columns["internalid"]);
        var companyname = rec.getValue(columns["companyname"]);
        return {
            internalId: internalId,
            companyname: companyname
    return data;

The main function (suitelet_aecc_example_app) returns a string representation of the data that was generated by getData function. To create a restlet go to Customization -> Scripting -> Scripts -> New

Add the file and click Create Script Record. On the following page choose RestLet:

The URL will also be generated automatically for this RestLet.

The result page looks like this one: