Price lists
•
Version: 10
Some tooltip text!
• 2 minutes to read
• 2 minutes to read
Retrieve price lists
NSPriceList GetPriceList(Integer priceListId)
Fetch a specific price list by its ID.
NSQuoteAgent qa;
NSPriceList priceList = qa.GetPriceList(2);
printLine(priceList.GetName() + ": " + priceList.GetCurrency());
Get multiple price lists from quote connection
You've got several variants of GetPriceList()
, which all return NSPriceList[]
and take the ID of a quote connection as the 1st argument.
Method | Currency | Only active | Include upcoming/expired |
---|---|---|---|
GetActivePriceLists | String | x | |
GetActivePriceListsByCurrencyId | Integer (ID) | x | |
GetAllPriceLists | String | x | |
GetAllPriceListsByCurrencyId | Integer (ID) | x |
NSQuoteAgent qa;
NSPriceList[] priceLists = qa.GetActivePriceLists(1, "NOK");
for(Integer i = 0; i < priceLists.length(); i++) {
printLine(priceLists[i].GetName());
}
Create price list
DateTime now;
NSQuoteAgent qa;
NSPriceList priceList = qa.CreateDefaultPriceList();
priceList.SetName("gardening tools fall 2020");
priceList.SetValidFrom(now);
priceList.SetValidTo(now.moveToYearEnd());
priceList = qa.SavePriceList(priceList);
printLine(priceList.GetPriceListId().toString());
Tip
By default, the new price list will be valid "forever", with the validity period set using the max and min value of the DateTime type.
Update price list
- Fetch the NSPriceList object with the agent.
- Call the appropriate set methods.
- Call
SavePriceList()
.
Delete price list
Integer priceListId = 99;
NSQuoteAgent qa;
qa.DeletePriceList(priceListId);
Reference
Frequently used price list fields
Field | Description |
---|---|
pricelist_id | ID |
Name | Label for UI |
Description | |
CurrencyId | The currency of the list |
ValidFrom | The date at which the list becomes valid |
ValidTo | The last date the list is valid |
IsActive | Link to product information web page |
IsERPCopy | Whether it's a cache and can't be changed in CRM |
For a complete list of fields, see the database reference.