Criteria:
Available is greater than 0
Inventory Location is Main
Inactive is false
Pricing: Price Level is Base Price
Results columns, sorted by Internal ID, then By: Pricing: Unit Price
Internal Id
Name
Location Available
Pricing: Quantity Range
Pricing: Unit Price
- When calling this above saved search via WS ItemSearchAdvanced the two result columns : Pricing: Quantity Range and Pricing: Unit Price would not get returned as WS as these fields are not exposed in the Schema Browser. A workaround would be to use a Restlet that would return the saved search results. You would use the api below in the Restlet file :
function xxx(datain) {
return nlapiSearchRecord('item', 'customsearch_test_pricing_fields', null, null);
// customsearch_test_pricing_fields is the id of the saved search created in UI
}
Then deploy this as a RESTlet by going in NetSuite in Setup -> Script -> New -> RESTlet, upload the javascript file you just created, add fucntion name as a GET function, and finally save and deploy the script. You'll see the URL that your application can call to retrieve your results
You can use Rest-Client to test the Restet.
URL: https://rest.na1.netsuite.com/app/site/hosting/restlet.nl?script=customscript_get_pricing&deploy=1
with HTTP headers:
Authorization: NLAuth nlauth_account=123456, nlauth_email=email@domain.com, nlauth_signature=password, nlauth_role=3
Content-Type: application/json
- Results will be in JSON :
{
"id": "x",
"recordtype": "inventoryitem",
"columns": {
"itemid": "Computer Systems : Desktop : xxxx",
"type": {
"name": "xx",
"internalid": "InvtPart"
},
"baseprice": xx,
"locationquantityavailable": x,
"quantityrange": "xx",
"unitprice": xx
}
No comments:
Post a Comment