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.
I suggest you create an array of items and search on those items.
Then you can process the search results matching against your request items by item internalid and compare the quantity.
If the amount requested breaks the rules you’re trying to enforce send back the response and don’t save the SO.
t(^__^t)
just serialize it manually