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 – https://www.xyz.com/example.html/?callback=jQuery545221&{%22orderdetail%22:[{%22id%22:%2289%22,%22quantity%22:2,%22price%22:%2213.96%22,%22amount%22:%2227.92%22},
{%22id%22:%2280%22,%22quantity%22:1,%22price%22:%2212.95%22,%22amount%22:%2212.95%22},
{%22id%22:%2281%22,%22quantity%22:2,%22price%22:%2210.95%22,%22amount%22:%2221.90%22},
{%22id%22:%2283%22,%22quantity%22:3,%22price%22:%2212.56%22,%22amount%22:%2237.68%22},
{%22id%22:%2275%22,%22quantity%22:4,%22price%22:%2212.95%22,%22amount%22:%2251.80%22}],
%22customer_id%22:%22180%20xyz%20abc%22,%22total_amount%22:%22152.25%22}&_=1580411441286

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

How are you validating the items being added to the HTML form? If you already have a mechanism that brings in those items to the HTML page, you can just include the quantity available field to validate against. In fact you can just filter that dataset by only bringing in the items that have available quantity to sell.

Beginner Answered on February 13, 2020.

Yes, while bringing , I have vaildate the quantity available, but if someone create a new order and submit it after some time, the quantity available will be changed , so i need to validate it before creating order in netsuite as well.

on February 13, 2020.
Add Comment

Your Answer

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