HomeTagSubmit NotesAsk AnythingLoginSubscribe Us
1. Feel Free to ask and submit anything on and get satisfactory answer
2. Registration is not compulsory, you can directly login via google or facebook
3. Our Experts are looking for yours ?.

web-service-netsuite: How to add a button in netsuite

i wanna add a button Approval in SalesOrder record,when user clicks on it,it has to generate In-transit id(autoincremented number).Help me i´m new to Netsuite.

web-service x 19
netsuite x 18
Posted On : 2014-08-05 14:02:54.0
profile veera - veera


I think whatever you want to do can be done by using Suitescript. The SuiteScript API includes several Record APIs that interact with the entire NetSuite record object. When you work with Record APIs, you are doing things such as creating, deleting, copying, or loading all elements of a record.

Whether you are working with standard NetSuite records (for example, Sale Order, Invoice, Customer, Vendor) or custom records you have created using SuiteBuilder, you will use all the same Record APIs to interact with the record object.

The elements of mostly records in NetSuite, include fields, subtabs, sublists, sublist fields, and buttons.

So in order to add a button on SalesOrder you first need to load its element i.e. button and then fire an event on it and call a function. and perform the operation in function.

Following are the steps to Run a User Event Script in NetSuite:
To run a user event script in NetSuite, you must:
1. Create a JavaScript file for your user event script.
2. Load the file into NetSuite.
3. Create a Script record.
4. Define all runtime options on the Script Deployment page.

******************** Following sample code Generates a Record Log ********************
This user event script creates an execution log entry containing the type, record type, and internalId of the current record.

function beforeLoad(type,form)
var newId = nlapiGetRecordId();
var newType = nlapiGetRecordType();
nlapiLogExecution(´DEBUG´,´<Before Load Script> type:´+type+´, RecordType: ´+newType+´, Id:´+newId);
unction beforeSubmit(type)
var newId = nlapiGetRecordId();
var newType = nlapiGetRecordType();
nlapiLogExecution(´DEBUG´,´<Before Submit Script> type:´+type+´, RecordType: ´+newType+´, Id:´+newId);
unction afterSubmit(type)
var newId = nlapiGetRecordId();
var newType = nlapiGetRecordType();
nlapiLogExecution(´DEBUG´,´<After Submit Script> type:´+type+´, RecordType: ´+newType+´, Id:´+newId);

User event scripts are executed on the NetSuite server. They are executed when users perform certain actions on records, such as create, load, update, copy, delete, or submit. Most standard NetSuite records and custom record types support user event scripts.

User event scripts cannot be triggered to run by other user event scripts. You can, however, execute a user event script from a call within a scheduled, portlet, or Suitelet script.

With user event scripts you can do such things as:
1. Implement custom validation on records
2. Enforce user-defined data integrity and business rules
3. Perform user-defined permission checking and record restrictions
4. Implement real-time data synchronization
5. Define custom workflows (redirection and follow-up actions)
6. Implement custom form customizations

For complete guide of suitescript visit:
Complete SuiteScript Guide(Tutorial)- Click Here


Posted On : 2014-08-06 02:17:00
Satisfied : 2 Yes  1 No
profile Rishi Kumar - Rishi Kumar
Reply This Thread

Post Answer
Please Login First to Post Answer: Login login with facebook -