# Set Auto-Numbering

Auto-numbering can be configured for line items upon saving. This feature is particularly useful when managing product options, as it helps to differentiate and organize each line item effectively.

<figure><img src="/files/Wqefwsl7sTZMYxjJyM7Q" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Auto-numbering applies only when saving through the Line Item Editor. It does not apply to Salesforce internal transactions (e.g., API, Data Loader, or manual deletions).
{% endhint %}

### Example: Assigning Auto-Numbering to Opportunity Products with Product Options

{% hint style="info" %}
This example demonstrates the configuration of a Line Item Editor for Opportunity Products:

* **Parent:** Opportunity
* **Line Item:** OpportunityLineItem
* **Lookup:** PricebookEntry
  {% endhint %}

Suppose you are saving opportunity products through the Line Item Editor on the Opportunity detail page, generating a quote from the opportunity, and syncing the updated data back to the opportunity. If the SortOrder field is not properly saved, line items for product options may appear in the wrong order, causing confusion for users. To address this, you can assign auto-numbering to the SortOrder field, ensuring correct ordering during syncing.

#### Builder Setup:

1. In the **Relate Objects** step of the builder, enter the API name of the **SortOrder** field in the **Auto-Number Field** setting.
2. To display the sort order, add the **SortOrder** field in the **Line Item Editor Setup** step.

<figure><img src="/files/z1Hh4s2nwm0LcsrCDJZ8" alt=""><figcaption></figcaption></figure>

#### Result:

When you launch the Line Item Editor, you will see **auto-numbered values** in the **Sort Order**(`SortOrder`) **column**.

{% hint style="info" %}
**By default**, line items are numbered in **increments of 100** (e.g., 100, 200, 300). **Option line items** for bundled products **are numbered sequentially under their parent line item (e.g., 101, 102).**
{% endhint %}

<figure><img src="/files/YMuQR5T4QXaKtFV6Qcyk" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
For option line items, **only the following fields will be displayed** in the editor:

* Product Name
* List Price
* Unit Price
* Quantity
* Total Price
* Discount Rate/Discount Amount
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.smallbuilder.com/smallbuilder-line-items/builder/builder-setup-steps/relate-objects/line-item-object/set-auto-numbering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
