I have to create a save search and fetch pricing of items which is quantity based. How to do that. For fetching unit price, I use the following formula.
DEC
When you turn on Multiple Prices and/or Quantity Pricing feature in NetSuite, there is an additional record joined to the item record called Pricing ({pricing}).
This new pricing join has {quantityrange}, {maximumquantity}, and {minimumquantity}. You can use these fields to add to your query of the item record, or you can go direct from the Pricing record which has a join to the item recording using field {item}.
AFAIK quantity pricing is not available in search joins/columns. You may alternatively load the record and get quantity pricing.
You can matrix field APIs to get pricing information after you load the record.
Note, that the pricing matrix id varies depending on whether multiprice and multicurrency features are enabled.
[Update]
There is this pricing
join, which is not documented.
In the Search UI it has useful fields like: currency
, minimuquantity
and maximumquantity
.
From the script I could get value for additonal fields like:
unitprice
, pricelevel
and quantityrange
To add an example:
var itemIds = [...]; // for some set of items
var itemPrices = nlapiSearchRecord('item', null,
[
new nlobjSearchFilter('internalid', null, 'anyof', itemIds),
new nlobjSearchFilter('currency', 'pricing', 'is', '1'), // use this line if you have multiple currencies. normally 1 is USD but this varies by account.
new nlobjSearchFilter('pricelevel', 'pricing', 'is', '5'), // default online price level id. You can use any id.
// new nlobjSearchFilter('customer', 'pricing', 'is', customerId) // if you are getting the prices for a particular customer
],[
new nlobjSearchColumn('unitprice', 'pricing'),
new nlobjSearchColumn('quantityrange', 'pricing')
]);
Note:
You probably want to limit your list of items because even this example will return a row count that is the # of items * # of price breaks. Without the currency and price level filters you can quickly use up the default search result limit (# of items * # of price levels * # of currencies * # of price breaks) and end up having to use slower strategies for returning the information.