Skip to main content
Solved

REST API Error 'CustomerID' cannot be empty

  • November 30, 2023
  • 2 replies
  • 174 views

Forum|alt.badge.img

Hello Everyone,

I'm having a recurring issue I've been facing while using the Acumatica REST API. I am attempting to delete a payment detail from a sales order, and intermittently, I receive the following error message: "'CustomerID' cannot be empty."

The sales order already exists in the system so I shouldn’t need to provide the CustomerID but even if I do I still get the error.

On top of this the error response from Acumatica contains the CustomerID populated as it should be.

Here's a general structure of my API request for reference :

{
  "OrderNbr": {
    "value": "000082"
  },
  "OrderType": {
    "value": "SO"
  },
  "Payments": [
    {
      "id": "544535ce-2f8f-ee11-991e-90ccdfb7d7ce",
      "delete": true
    }
  ]
}

 

As well as a portion of the response

{
  "id": "e6f8ec91-2b8f-ee11-991e-90ccdfb7d7ce",
  "rowNumber": 1,
  "note": {
    "value": ""
  },
  "error": "'CustomerID' cannot be empty.; CustomerID: 'CustomerID' cannot be empty.",
  ...
  "CustomerID": {
    "value": "2842011255"
  },

...

Best answer by jinin

Hi @matthewgerdan ,

To delete the payment from the order, you should pass the ReferenceNbr instead of the sessionID.

Could you try like below?

{

    "OrderType": {

        "value": "SO"

    },

    "OrderNbr": {

        "value": "SO007470"

    },

    "Payments": [

        {

            "ReferenceNbr": {

                "value": "004480"

            },

            "DocType": {

                "value": "PMT"

            },

            "delete": true

        }

    ]

    

}

2 replies

jinin
Pro I
Forum|alt.badge.img+11
  • Pro I
  • 722 replies
  • Answer
  • November 30, 2023

Hi @matthewgerdan ,

To delete the payment from the order, you should pass the ReferenceNbr instead of the sessionID.

Could you try like below?

{

    "OrderType": {

        "value": "SO"

    },

    "OrderNbr": {

        "value": "SO007470"

    },

    "Payments": [

        {

            "ReferenceNbr": {

                "value": "004480"

            },

            "DocType": {

                "value": "PMT"

            },

            "delete": true

        }

    ]

    

}


Forum|alt.badge.img
  • Author
  • Varsity I
  • 23 replies
  • November 30, 2023

thanks @jinin that worked :)