Wednesday, March 20, 2019

Get item data using the getItemFieldValues method on ShoppingSession object

This is a sample snippet of the SSP ShoppingSession method getItemFieldValues(items)

function service(request, response){
 // Request a hardcoded inventory item
 var item = new Array();
 item[0] =  new Object();
 item[0].internalid = '47';
 item[0].itemtype = 'InvtPart';

 // Return item values for the requested inventory item
 var shoppingSession = nlapiGetWebContainer().getShoppingSession();
 var itemfieldValues = shoppingSession.getItemFieldValues(item);
  
 var itemJSON = JSON.stringify(itemfieldValues);

 nlapiLogExecution('DEBUG', 'itemfieldValues', itemJSON);

 response.setContentType('JSON');
 response.writeLine(itemJSON); 
}

No comments:

Post a Comment