Missing required field: internalid
/**
* Empty the cart and add the new items in the Cart. Used by the product detail page to insure there is only the wanted item in the cart
*
* @response no response
* @param {nlobjRequest} request : the information on the request like parameters and who called the service
* @param {nlobjResponse} response : the object that is going to contain the response which in this case is nothing
* @Governance 20 Units
*/
function service(request, response) {
var itemOptions = request.getParameter('options');
if (itemOptions != null && itemOptions != '') {
itemOptions = JSON.parse(itemOptions);
}
else {
itemOptions = null;
var order = nlapiGetWebContainer().getShoppingSession().getOrder();
order.removeAllItems();
order.addItem({
internalid : request.getParameter('internalid'),
quantity : request.getParameter('quantity'),
options : itemOptions
});
response.setContentType('JSON');
response.write('{}');