{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":37184,"path":"order-management/configure-invoice-quantity-check-ep.md","title":"Configure the invoice quantity validation extension point","bundle":null,"doc_type":null,"release":"australia","body":"\n# Configure the invoice quantity validation extension point\n\nImplement the invoice quantity check extension point to enable the invoice dispute intake assistant AI agent to validate a customer's quantity dispute claim by reconciling it with delivered quantity data from your Enterprise Resource Planning \\(ERP\\) or inventory system.\n\n## Before you begin\n\nThe application scope must be set to Manage Invoice Operations. You can change the application scope using the application picker \\[Omitted image \"globe-outline-24.svg\"\\] Alt text: in the Unified Navigation bar.\n\nRole required: admin\n\n## About this task\n\nThe demo data for the Manage Invoice Operations application includes a sample implementation called invoiceQuantityCheckDemo as part of the sn\\_inv\\_ops\\_aias.invoiceQuantityCheckEP extension point. To enable real-world validation of quantity disputes against your external ERP system or inventory delivery records, replace the demo implementation with your own custom logic.\n\nThe demo implementation also illustrates a fallback pattern. When sold product information is unavailable on an invoice line, the function validates the disputed quantity against the corresponding sales order line quantity instead. You can mirror this pattern in your custom implementation when applicable.\n\n## Procedure\n\n1.  Log in to the ServiceNow instance.\n\n2.  Navigate to **All** &gt; **System Extension Points** &gt; **Scripted Extension Points**.\n\n3.  Search for the sn\\_inv\\_ops\\_aias.invoiceQuantityCheckEP scripted extension point in the **API Name** field.\n\n4.  View the sample script included in the demo data by selecting **sn\\_inv\\_ops\\_aias.invoiceQuantityCheckEP**.\n\n5.  Create your own implementation of the extension point by selecting the **Create implementation** related link.\n\n6.  On the Script Include form, fill in the fields.\n\n    For a description of the Script Include form fields, see [Script includes](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/scripts/c_ScriptIncludes.md).\n\n7.  Override the functions in the script to implement your logic for validating the customer's quantity dispute claim.\n\n    -   **checkInvoiceQuantityWithInvoiceCase**\n\n        Placeholder function meant to be overridden. Use this placeholder to implement the logic to validate quantity disputes across multiple invoice lines associated with an invoice case.\n\n        Input:\n\n        ```\n        {\n            \"invoiceNumber\": <Invoice number of the customer invoice record>,\n            \"verifiedInvoiceLineDetails\": <Array of invoice line details>\n        ```\n\n        Output:\n\n        ```\n        {\n        “invoiceLineNumber”: <Invoice line number against which the dispute was raised>,\n        “disputedQuantity”: <Disputed quantity claimed by the customer, as available in the invoice case line>\n        }\n        ```\n\n    -   **checkInvoiceQuantity**\n\n        Placeholder function meant to be overridden. Use this placeholder to implement the logic to validate a quantity dispute by reconciling the customer's claimed quantity against your ERP or inventory delivery records.\n\n        Input:\n\n        ```\n        {\n            \"invoiceNumber\": <Invoice number of the customer invoice record>,\n            \"invoiceLineNumber\": <Invoice line number of the customer invoice line record against which the dispute was raised>,\n            \"userEnteredQty\": <Disputed quantity claimed by the customer>\n        }\n        ```\n\n        Output:\n\n        ```\n        {\n            \"invoiceLineNumber\": <Invoice line number against which the dispute was raised>,\n            \"invoiceQty\": <Actual quantity on the invoice line record>,\n            \"deliveredQty\": <Integer representing the disputed quantity claimed\n                              by the customer>,\n            \"qtyMatch\": <Boolean; true if the customer's dispute claim is valid, false if the invoiced and claimed quantities match>,\n            \"isError\": <Boolean; true if the API call failed, false if the API call was successful>,\n            \"errorMessage\": <Error message string to handle failure scenarios>\n        }\n        ```\n\n8.  Select **Update**.\n\n9.  Validate your implementation by submitting an invoice dispute from the Business Portal using the ServiceNow Otto Virtual Agent.\n\n    For more information, see [Dispute invoice issues using ServiceNow Otto Virtual Agent](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/dispute-invoice-issues-now-assist.md).\n\n\n**Parent Topic:**[Configuring the Manage Invoice Operations application](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/order-management/configuring-manage-invoice-operations.md)\n\n**Related topics**  \n\n\n[Using extension points to extend application functionality](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/web-services/extension-points.md)\n\n[Creating and adding a scripted extension point](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/web-services/impl-scripted-ext-pts-base-code.md)\n\n"}}