4D QuickBooks Integrator: QuickBooks Price Levels


How can I retrieve and use custom price levels for items in QuickBooks?

Price levels allow for custom pricing for different customers or jobs. Once a price level is created and associated with one or more customers or jobs, transactions created for those customers or jobs will automatically pull up the correct custom price.

Price levels can be retrieved from QuickBooks using the ObjSearch component in conjunction with the PriceLevel component. To search for Price Levels, simply set the QueryType to qtPriceLevelSearch and call the Search method. Below is some sample code to search and output price level information.

Note that because price level functionality was added to the QuickBooks SDK in version 4.0, the QBXMLVersion must be set to “4.0” or higher when dealing with price level data.

Objsearch objsearch1 = new Objsearch(); objsearch1.QBConnectionString = _qbConnectionString; objsearch1.QBXMLVersion = "12.0"; // Must be set to "4.0" or greater objsearch1.QueryType = ObjsearchQueryTypes.qtPriceLevelSearch; objsearch1.Search(); for (int i = 0; i < objsearch1.Results.Count; ++i) { Pricelevel level1 = new Pricelevel(); level1.QBResponseAggregate = objsearch1.Results[i].Aggregate; Console.WriteLine("PriceLevel: " + level1.RefId + " - " + level1.PriceLevelName); foreach (PriceLevelItem item in level1.Items) { Console.WriteLine("Item Name: " + item.ItemName + "; Price: " + item.CustomPrice + "; PricePercent: " + item.CustomPricePercent); } }

When adding transactions for customers, the correct price level will automatically be used if no price information (i.e. Amount or Rate) is specified. If the price level for a line item must be specified, the PriceLevelId or PriceLevelName properties can be used. For example:

Invoice1.LineItems[i].PriceLevelId = level1.RefId; // or Invoice1.LineItems[i].PriceLevelName = level1.PriceLevelName;

Price levels can be specified on line items for invoices, sales receipts, credit memos, and sales orders. Note that when these transactions are retrieved from QuickBooks, the response data does not include the price level that was used; only the rate is returned.

We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@4dpayments.com.