# Control Line Item Deletion

Control the deletion of saved line items based on their status by specifying a Boolean field that determines whether deletion is allowed. If the specified field value is true, the delete button will be disabled for the corresponding line item.

<figure><img src="/files/2djRL3MMn8muEyhENgFw" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
DelDeletion control applies only within the Line Item Editor and does not affect Salesforce internal processes like API operations, Data Loader, or manual deletion.
{% endhint %}

### Example: Restrict Deletion of Approved Opportunity Products

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

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

For Opportunity Products linked to an Opportunity, deletion should be restricted when the product is in an approved state. To configure this, the `Approved__c` field is used to control deletion.

#### Builder Setup

Set the `Approved__c` field as the deletion control field in the builder. Enter the API name of the field into the Deletion Control Field setting.

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

#### Result

When the `Approved__c` field value is true, the delete button is hidden, preventing deletion of the corresponding line item.

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


---

# 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/control-line-item-deletion.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.
