# Remove-ERPObject Cmdlet to remove a specific entity from the ERP-System. ## Syntax ```powershell Remove-ERPObject [[-EntitySet] ] [[-Keys] ] [] ``` ## Parameters | Type | Name | Description | Optional | |----------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------| | String | EntitySet | The EntitySet name where the item is located.
It is also possible to specify additional namespaces or the whole url (e.g MaterialService/Materials, ) | no | | Hashtable / PSObject | Keys | The reference properties for the searching item | | | no | ## Return type **Bool**:\ **\$true** ← on success.\ **\$false** ← on failure. Exception/ErrorMessage can be accessed using [\$Error]().\ If the cmdlet fails due to error responses returned by the ERP system, the \$Error variable provides a [WebRequestException]() . ## Remarks This Cmdlet is used to delete a specific object from the ERP System. ## Examples In the following examples we are using public OData Services () for demonstration purposes: **Remove Product with Id 1** ```{code-block} powershell :linenos: true Connect-ERP -Service "http://services.odata.org/V3/(S(xnnohcch2jddbn1z1ytpfni2))/OData/OData.svc/" Remove-ErpObject -EntitySet "Products" -Keys @{"ID"=1} ``` **Search for Product and remove it** ```{code-block} powershell :linenos: true Connect-ERP -Service "http://services.odata.org/V3/(S(xnnohcch2jddbn1z1ytpfni2))/OData/OData.svc/" $product = Get-ERPObject -EntitySet "Products" -Keys @{"ID"=10} Remove-ErpObject -EntitySet "Products" -Keys $product._Keys ``` **Error handling, analyze why the ERP object could not be removed, by using \$Error** ```{code-block} powershell :linenos: true Connect-ERP -Service "http://services.odata.org/V3/(S(xnnohcch2jddbn1z1ytpfni2))/OData/OData.svc/" $result = Remove-ErpObject -EntitySet "Products" -Keys @{} if(-not $result){ $Error[0].Exception #"Following mandatory properties in entity 'Product' are missing: 'ID'" } ```