My Products
Help
alexandreveeck
CONTRIBUTOR **

Error creating customer invoice: Object reference not set to an instance of an object.

by alexandreveeck

Hi 

 

I'm posting the following invoice to the API:

{
  "invoiceLines": [
    {
      "operation""Insert",
      "inventoryNumber": {
        "value""086L0767-TH"
      },
      "quantity": {
        "value"1
      },
      "uom": {
        "value""STK"
      }
    }
  ],
  "sendToAutoInvoice": {
    "value"false
  },
  "customerNumber": {
    "value""00033"
  },
  "documentDate": {
    "value""2023-03-23"
  },
  "invoiceText": {
    "value""test"
  }
}

 

URL: 

https://integration.visma.net/API/controller/api/v2/customerinvoice

 

I'm getting this error: 

{
    "message""VismaId: 59d0f756-c85f-4b87-b0d9-cf4bbe2b54ca. Object reference not set to an instance of an object."
}
 
According to the documentation these would be the required values to create the customer invoice.
 
I also tried to send an invoice number but I got the same message. 
2 REPLIES 2
Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

Posting the same JSON but replacing customer & inventoryItem to one of our local works.

The issue seems to be with either your inventory item or your customer.

We would recommend that you try to recreate the same invoice in the UI.

This should trigger the same error.

Please let us know what caused your issue when you have tried this so that we can open a case with the development team. 

Thank you. 

alexandreveeck
CONTRIBUTOR **

by alexandreveeck (Updated ‎24-03-2023 17:18 by alexandreveeck )

I tried to create the invoice using the UI and I had an error just after typing the customer number. The error was caused by one space on the customer's postal code.  After removing the space I could create the invoice using the API. 

Thank you for your help, Magnus!