> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Products

> Each product belongs to a single price list. How to work with products in CRMScript.

## Fetch products

### NSProduct GetProduct(Integer quoteConnectionId, String eRPProductKey)

To call `GetProduct()`, you need the ID of both the quote connection and of the product itself.

```crmscript theme={null}
NSQuoteAgent qa;
NSProduct product = qa.GetProduct(1,"3412-20");
```

### NSProduct GetProductFromDbId(Integer productId)

A variant of `GetProduct()` that lets you retrieve by database ID.

```crmscript theme={null}
NSQuoteAgent qa;

NSProduct product = qa.GetProductFromDbId(3);

printLine(product.GetName() + "\t" + product.GetCode());
```

## Create product

```crmscript! theme={null}
NSQuoteAgent qa;
NSProduct product = qa.CreateDefaultProduct();

product.SetName("bulb planter");
product.SetERPPriceListKey("5");

product = qa.SaveProduct(product);

printLine(product.GetProductId().toString());
```

## Update product

1. Fetch the NSProduct object with the agent.
2. Call the appropriate *set* methods.
3. Call `SaveProduct()`.

## Delete product

```crmscript theme={null}
Integer productId = 99;
NSQuoteAgent qa;
qa.DeleteProduct(productId);
```

### Remove from database

```crmscript theme={null}
Integer productId = 88;
NSQuoteAgent qa;
qa.RemoveProduct(productId);
```

## Reference

### Frequently used product fields

| Field          | Description                                                       |
| :------------- | :---------------------------------------------------------------- |
| product\_id    | ID                                                                |
| PriceListId    | the price list the product belongs to                             |
| Name           | label for UI                                                      |
| Description    |                                                                   |
| Code           | the product code or article number in the product supplier system |
| PriceUnit      | what kind of amount the price pertains to                         |
| IsSubscription | whether it's a recurring offer                                    |
| Url            | link to product information web page                              |
| VAT            | percentage                                                        |
| UnitListPrice  | the basic price from which the discount is computed from          |
| InAssortment   | whether currently offered or out-of-stock/discontinued            |

For a complete list of fields, see the [database reference][1].

[1]: ../../../../database/tables/product


## Related topics

- [Product](/en/api/archive-providers/reference/product.md)
- [Products](/en/api/reference/restful/rest/list_price/products.md)
- [Delete Product](/en/api/reference/restful/rest/product/delete-product.md)
- [NSProduct](/en/automation/crmscript/reference/CRMScript.NetServer.NSProduct.md)
- [Post Product](/en/api/reference/restful/rest/product/post-product.md)
- [Default Product](/en/api/reference/restful/rest/product/default-product.md)
