--- title: "Line Items Operations Configurer" slug: "line-items-operations-configurer" updated: 2023-06-27T14:23:07Z published: 2023-06-27T14:23:07Z canonical: "docs.zilliant.com/line-items-operations-configurer" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Line Items Operations Configurer Class For each line in the **Line Items** list view, the **Editable**, **Deletable** and **Visible** fields are set. These values are not stored permanently, but are run each time the **Line Items** view is displayed to a specific user. These values are specific to the instance and the **Product Selector Configuration** registered to that view. If the line is marked as **Non-visible** by this service (**Visible = false**), then it does not appear in the **Line Items** component. If the line is marked as **Visible** by this service (**Visible = true**), then it appears in the **Line Items** component except when the line is marked **Visible** and **Non-editable** and the **Hide Non-editable lines** flag is enabled. Use this Apex hook to control the **Editable/Deletable** and **Visible** status of lines when your desired business logic for determining these states cannot be applied by using a simple Salesforce formula field and dialog filters. The Apex hook occurs before records are loaded into the **Line Items** list. The lines are first processed by the custom logic in the hook, and then loaded into the user's **Line Items** view. ## Apex hook class - It must implement one of the following interfaces: - **zpl.LineItemOperationsConfigurer** - **zpl.LineItemsOperationsConfigurer** - It must have a global access modifier. - You must specify the Apex hook class name in the **Line Items Operations Configurer Class** field of the **Product Selector Configuration**. ## Definition for the zpl.LineItemOperationsConfigurer interface ``` global interface LineItemOperationsConfigurer { LineItemOperations getSupportedOperations(SObject item); } ``` The **getSupportedOperations()** method accepts a line item record and returns an instance of **LineItemOperations** data structure that describes whether edit and delete operations are permitted for the provided line item. The method is executed multiple times for each line item, so complex initialization or SOQL queries must be defined in the constructor. Tip If access to all line items is required in order to compute permitted operations, you should use **zpl.LineItemsOperationsConfigurer** instead. ## Definition for the zpl.LineItemsOperationsConfigurer interface ``` global interface LineItemsOperationsConfigurer { Map getSupportedOperations(SObject[] lineItems); } ``` The **getSupportedOperations()** method returns all line items that need metadata about the allowed operations in its lineItemsparameter. A map of **LineItemOperations** instances with corresponding line item IDs used as the map keys must be returned. The line items without Salesforce IDs and returned from the method are treated as editable and deletable. #### Definition for the zpl.LineItemOperations class ``` global class LineItemOperations { global Boolean editable { get; private set; } global Boolean deletable { get; private set; } global Boolean visible { get; private set; } global LineItemOperations(Boolean isEditable, Boolean isDeletable) { this.editable = isEditable; this.deletable = isDeletable; this.visible = true; } global LineItemOperations(Boolean isEditable, Boolean isDeletable, Boolean isVisible) { this(isEditable, isDeletable); this.visible = isVisible; } } ``` ## Example of the class implementation The following hook code will receive a list of lines and for each line where the Price is greater than 1000, that line will be marked as **Editable** (**Editable=True**) and **Not Deletable** (**Deletable=False**). And if the Price is less than 0, that line will be marked as **Not Editable** (**Editable=False**) and **Deletable** (**Deletable=True**). ``` global with sharing class SimpleLineItemOperationsConfigurer implements zpl.LineItemOperationsConfigurer { global zpl.LineItemOperations getSupportedOperations(SObject item) { if (item instanceof zpl__ContractLineItem__c) { zpl__ContractLineItem__c contractLineItem = (zpl__ContractLineItem__c) item; if (contractLineItem.zpl__ContractPrice__c > 1000) { return new zpl.LineItemOperations(false, true); } else if (contractLineItem.zpl__ContractPrice__c < 0) { return new zpl.LineItemOperations(true, false); } else if (contractLineItem.zpl__ContractPrice__c > 500) { return new zpl.LineItemOperations(true, true, false); } } return new zpl.LineItemOperations(true, true); } } ```