Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Acumatica REST API - Delete SalesOrderDetail

Tags:

rest

acumatica

I'm trying to delete a specific SalesOrderDetail record (from the id value) using the REST API.

I don't see a way to do it using the default API. I've tried customizing the Web Service Endpoint to create a top-level entity for SalesOrderDetail so that I can use the DELETE method with it, but it didn't seem to work.

I've also tried adding an action to the SalesOrder endpoint that would let me delete a row on the details, but the action isn't available for me to use and I'm not sure how to access it.

Does anyone know how this can be done?

like image 527
Ethan H. Avatar asked Sep 19 '25 06:09

Ethan H.


1 Answers

You can delete the detail line of an item by setting the delete property of the detail entity to true. This can be done with any endpoint and here is how:

First retrieve the record with the detail you want to remove:

GET : https://localhost/MyStoreInstance/entity/Default/18.200.001/SalesOrder?$expand=Details&$select=OrderNbr,OrderType,Details/InventoryID,Details/ WarehouseID&$filter=OrderType eq 'SO' and CustomerOrder eq 'SO248-563-06'

You should get a similar result:

[
    {
        "id": "c52bd7ac-c715-4ce3-8565-50463570b7d9",
        "rowNumber": 1,
        "note": "",
        "CustomerOrder": {
        "value": "SO248-563-06"
        },
        "Details": 
        [
            {
                "id": "988988a5-3bc0-4645-a884-8a9ba6a400b4",
                "rowNumber": 1,
                "note": "",
                "InventoryID": {
                "value": "AALEGO500"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            },
            {
                "id": "983f9831-b139-489c-8ad0-86d50f6e535d",
                "rowNumber": 2,
                "note": "",
                "InventoryID": {"value": "CONTABLE1"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            },
            {
                "id": "19193380-63b2-445c-a50b-fd6d57f176a0",
                "rowNumber": 3,
                "note": "",
                "InventoryID": {"value": "CONGRILL"},
                "WarehouseID": {"value": "MAIN"},
                "custom": {},
                "files": []
            }
        ],
        "OrderNbr": {"value": "000003"},
        "OrderType": {"value": "SO"},
        "custom": {},
        "files": []
    }
]

You can then resent in a PUT request with the following body in order to delete the corresponding detail line

{
    "OrderType":{"value":"SO"},
    "OrderNbr":{"value":"000003"},
    "Hold":{"value":false},
    "Details":
    [
        {
            "id":"19193380-63b2-445c-a50b-fd6d57f176a0",
            "delete":true
        }
    ]
}
like image 70
samol518 Avatar answered Sep 21 '25 20:09

samol518