Modules
Objects/Functions
SuiteScript 2.0
// Please search https://system.netsuite.com/app/help/helpcenter.nl?search=ServerRequest.parameters for more information.
N/http Module
ServerRequest.parameters
Property Description:
The server request parameters, as name:value pairs. Note that if the server request is a Get request, parameters are sent as part of the URL. If the server request is a Post request, parameters are sent within the request body.
Parameters cannot be arrays. Use JSON.stringify/JSON.parse instead to handle arrays.
Type:
Object (read-only)
Supported Script Types:
Server scripts
For more information, see SuiteScript 2.0 Script Types.
Module:
N/http Module
Parent Object:
http.ServerRequest
Sibling Object Members:
ServerRequest Object Members
Since:
2015.2
Search NetSuite -
https://system.netsuite.com/app/help/helpcenter.nl?search=ServerRequest.parameters
Example:
// Code Example 1
// Add additional code
//...
// example from a Suitelet
onRequest: function(context) {
// in the following, context.request is an http.ServerRequest (per Suitelet onRequest(params.request) entry point)
if (context.request.method === 'GET') {
// request is coming from a User Event script, for instance, on a form load; parameters are in the URL as name:value pairs (as the query string)
var myName = context.request.parameters.custpage_nameParam; // here, 'custpage_nameParam' and 'custpage_phoneParam' are parameter names set
var myPhone = context.request.parameters.custpage_phoneParam; // by the requesting script and sent in the HTTP request
}
if (context.request.method === 'POST'){
// request is coming from a Submit button click on the form, submitting the form (via user event script); parameters are in the form fields
var myName = context.request.parameters.nameFld; // here, 'nameFld' and 'phoneFld' are field ids on the form for the Name and Phone fields
var myPhone = context.request.parameters.phoneFld;
}
}
//...
// Add additional code
//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4314803781.html