{"title":"Delete&lt;part&gt; Operation","url":"https://jonas-paprotka.de/docs/dev-itpro/webservices/delete_-part--operation/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/delete_-part--operation, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/delete_-part--operation","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","date":"2021-04-01","meta":{"topic":"reference"},"outline":[{"level":2,"title":"Method Signature","slug":"method-signature","at":1827,"chars":53},{"level":2,"title":"Parameters","slug":"parameters","at":1880,"chars":164},{"level":2,"title":"Results","slug":"results","at":2044,"chars":138},{"level":2,"title":"Faults","slug":"faults","at":2182,"chars":479},{"level":2,"title":"Usage Example","slug":"usage-example","at":2661,"chars":878},{"level":2,"title":"Related information","slug":"related-information","at":3539,"chars":44}],"text":"Deletes records on a subpage of the current page.\nThis operation is exposed only by pages that have subpages, which are pages that have parts of type Page. For example, the Sales Order page has a part with the name SalesLines, which has PartType equal to Page and PagePartID equal to \"Sales Order Subform.\" The name of the operation that is exposed by the Sales Order page is Delete_SalesLines.\nWhen you call this operation, you delete a record of the subpage. When you call Read on a page that has a subpage, you get the records of the top-level page and the corresponding records of the subpage. To modify them or add to them, you must modify the whole top-level record.\nExecuting the Delete_\\<part> operation in a web service first executes the ../developer/triggers-auto/page/devenv-ondeleterecord-page-trigger on the designated record of the subpage. If application code in the OnDeleteRecord trigger for the record of the subpage returns true, then the ../developer/triggers-auto/table/devenv-ondelete-table-trigger for the corresponding table is executed. If no fault occurs, then the record of the subpage is deleted from the database.\nIf the application code in the trigger returns false, then the OnDelete trigger is not executed. This does not necessarily mean that the record of the subpage has not been deleted because it may have been deleted explicitly by the application code for the page's OnDeleteRecord trigger.\nThe return value from the Delete_\\<part> operation is the return value from the page's OnDeleteRecord trigger.\nIf Delete returns true, then the record of the subpage has been deleted. If Delete has thrown a fault, then the record of the subpage has not been deleted. When Delete returns false, there was application logic involved, and the record of the subpage may or may not have been deleted.\n## Method Signature\n`bool Delete_<part>(string key)`\n## Parameters\nParameter|Description\nkey|Type: String<br /><br /> The bookmark of the record of the subpage, including both primary key and concurrency information.\n## Results\nResult name|Description\nDelete_Result|Type: Boolean<br /><br /> The value that is returned by the OnDeleteRecord page trigger.\n## Faults\nSOAP fault message|Description\nOther user has modified \\[*record name*\\].|Indicates that another user or process has modified the record of the subpage after it has been retrieved for this delete operation.\n\\[*record name*\\] \\[*field*\\] \\[*value*\\] does not exist.|Indicates that the record of the subpage has been deleted by another user or process after it has been retrieved for this delete operation.\nOther faults are possible if they are generated by the AL code.\n## Usage Example\nThis example presents a console application that is created in Visual Studio after registering and publishing the Sales Order page. After you publish the page as a web service, you must also add a web reference to it. This task is also described in the walkthrough.\n```c#\nusing Delete_SalesLinesSample.DynamicsNAVService;\n\nnamespace Delete_SalesLinesSample\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            DynamicsNAVService.SalesOrder_Binding so = new SalesOrder_Binding();\n            so.UseDefaultCredentials = true;\n\n            SalesOrder salesOrder = so.Read(\"2001\");\n            Sales_Order_Line[] salesLines = salesOrder.SalesLines;\n\n            if (salesLines.Length > 0)\n            {\n                string key = salesLines[0].Key;\n                so.Delete_SalesLines(key);\n            }\n        }\n    }\n}\n```\n## Related information\nbasic-page-operations"}