RE: Post json response to suitelet to create sales order in Netsuite. We are using version 2 *@NApiVersion 2.x

I need to write a suitelet to get data submitted from html page as json response and use this data to create a sales order page

This is sample response from html submit button

GET –{%22orderdetail%22:[{%22id%22:%2289%22,%22quantity%22:2,%22price%22:%2213.96%22,%22amount%22:%2227.92%22},

where id = 89 , quantity = 2, price = 13.96, amount = 27.92 (2*13.96) in first line
id = 80 , quantity = 1, price = 12.95, amount = 12.95 (1*12.95) in second line and so on’
here are total 5 different items in same order (in array orders)
and in last line
there is customer_id =180 xyz abc , total amount = 152.25

I need help in processing this response to suitelet to create a sales order.

sadi Rookie Asked on February 4, 2020 in SuiteScript.

just serialize it manually

on April 7, 2021.
Add Comment
12 Answers

Replace this…

if (context.request.method === ‘GET’) {

// Get parameters
var customer_id = context.request.parameters.customer_id;
var total_amount = context.request.parameters.total_amount;
var id =;
var quantity = context.request.parameters.quantity;
var price = context.request.parameters.price;
var amount = context.request.parameters.amount;


if (context.request.method === ‘POST’) {
var data =  context.request.body;
var soData = JSON.parse(data);
...and then your salesorder creation code would look like this
sublistId: ‘item’
sublistId: ‘item’,
fieldId: ‘item’,
sublistId: ‘item’,
fieldId: ‘quantity’,
value: soData.quantity
Beginner Answered on February 4, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.