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
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.