I have a script that updates the product data in NetSuite on another system. When this occurs, I get response 200 and json with the product id on the other system. I would like to know how do I get this id (97323), as I need to set a field in the item record in NetSuite.
Here's the code:
var response = admin.post(url_produto_save,
{'Authorization': authorization, 'Content-Type': content_type, 'User-Agent-x': user_agent_x },
bodyObject);
log.audit({ title: 'Response Status', details: response.code });
log.audit({ title: 'Response Body', details: response.body });
So you response.body
is showing {"status":"ok"...
when logged and you want to get the value of the idproduto
.
If I did understand well your request, then you can try two things:
response.body.idproduto
If that didn't work, then you can parser the "body" and then use it:
var parsedBody = JSON.parse(response.body);
var idItem = parsedBody.idproduto;