# 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="https://3800415611-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNuSjRiJMvVhtdzNDzWBi%2Fuploads%2FrSF97Kak8DIWfZDc7AMC%2FLineItem_AutoNumber_Overview.png?alt=media&#x26;token=d1c0cb68-3844-4593-8f36-d54fe522fc7f" 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="https://3800415611-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNuSjRiJMvVhtdzNDzWBi%2Fuploads%2FXOL9ZVi0ChsPXzWJpVy8%2FLineItem_Sorting_Ex.png?alt=media&#x26;token=95054422-fbf8-4e6f-89bd-6c0e2675e9d1" 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="https://3800415611-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNuSjRiJMvVhtdzNDzWBi%2Fuploads%2FEm7hm7vvxE8JciVJCstD%2FLineItem_Sorting_Result.png?alt=media&#x26;token=159da169-8789-4078-bafa-ab7708883c5c" 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 %}
