My Products
Help
KonsultVn
CHAMPION ***

Customer invoice POST returns "Object reference not set to an instance of an object.."

by KonsultVn

Hi! 

We're once again having problems creating a specific customer invoice where we get back a message that is difficult to interpret in the form of {"message":"VismaId: 31e7c153-86a7-4d17-8568-7d2ca5b233f4. Object reference not set to an instance of an object."}


Could you please help us in this case as soon as possible as well as look into handling this error in a better way?

 

Company-Id: 4609946

Below is the JSON

{
"ReferenceNumber": {
"Value": "1923"
},
"Note": {
"Value": "[Fakturanummer: XXXX;KF23]"
},
"DocumentDate": {
"Value": "2023-06-01T00:00:00"
},
"CurrencyId": {
"Value": "EUR"
},
"CreditTermsId": {
"Value": "60"
},
"Hold": null,
"OverrideNumberSeries": {
"Value": true
},
"BranchNumber": null,
"ExternalReference": {
"Value": "XXX"
},
"CustomerRefNumber": null,
"UnitOfMeasure": null,
"InvoiceText": {
"Value": "Avtal XX-XX XXX"
},
"ExchangeRate": null,
"Contact": null,
"CustomerNumber": {
"Value": "10034"
},
"SalesPerson": null,
"LocationId": null,
"AccountNumber": null,
"PaymentReference": {
"Value": "XXXX"
},
"FinancialPeriod": {
"Value": "202306"
},
"Subaccount": null,
"InvoiceLines": [
{
"InventoryNumber": null,
"Description": {
"Value": "Avtalsnr: XX-XX, Avtalsperiod: 2023-06-01 - 2024-05-31"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "-"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "Facility:\r\n XXX"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "-"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "Portar"
},
"Uom": null,
"Quantity": {
"Value": 12.0
},
"UnitPriceInCurrency": {
"Value": 42.12
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "19 Doors á 25 SEK"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "-"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "-"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "\"Reverse charge\""
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "-"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "Ert momsregistreringsnummer XXXX"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
},
{
"InventoryNumber": null,
"Description": {
"Value": "Omvänd betalningsskyldighet gäller för denna faktura"
},
"Uom": null,
"Quantity": {
"Value": 1.0
},
"UnitPriceInCurrency": {
"Value": 0.0
},
"ManualAmountInCurrency": null,
"Note": null,
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert",
"LineNumber": null,
"ManualDiscount": null,
"DiscountPercent": {
"Value": 0.0
},
"DiscountAmountInCurrency": null,
"DeferralCode": null
}
]
}

 

 

 

4 REPLIES 4
Yıldırım
VISMA

by Yıldırım

Hi, in the first place, please modify your json by cleaning up the Null & "Value": 0.0 fields and retry. 

KonsultVn
CHAMPION ***

by KonsultVn

Hi,

I tried this but we still get the same problem

"message": "VismaId: cf5e5143-a594-47a5-8562-9a9b163ed234. Object reference not set to an instance of an object."

 


We need to import this invoice into Visma as quickly as possible.

Can you try import the invoice and see what the problem is?

 

Modified json below

{
"ReferenceNumber": {
"Value": "1923"
},
"Note": {
"Value": "[Fakturanummer: XXXX;KF23]"
},
"DocumentDate": {
"Value": "2023-06-01T00:00:00"
},
"CurrencyId": {
"Value": "EUR"
},
"CreditTermsId": {
"Value": "60"
},
"OverrideNumberSeries": {
"Value": true
},
"ExternalReference": {
"Value": "XXX"
},
"InvoiceText": {
"Value": "Avtal XX-XX XXX"
},
"CustomerNumber": {
"Value": "10034"
},
"PaymentReference": {
"Value": "XXXX"
},
"FinancialPeriod": {
"Value": "202306"
},
"InvoiceLines": [
{
"Description": {
"Value": "Avtalsnr: XX-XX, Avtalsperiod: 2023-06-01 - 2024-05-31"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "-"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "Facility:\r\n XXX"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "-"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "Portar"
},
"Quantity": {
"Value": 12.0
},
"UnitPriceInCurrency": {
"Value": 42.12
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "19 Doors á 25 SEK"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "-"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "-"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "\"Reverse charge\""
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "0000000"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "00"
},
{
"SegmentId": 4,
"SegmentValue": "00"
},
{
"SegmentId": 5,
"SegmentValue": "00"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "-"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "Ert momsregistreringsnummer XXXX"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
},
{
"Description": {
"Value": "Omvänd betalningsskyldighet gäller för denna faktura"
},
"Quantity": {
"Value": 1.0
},
"Subaccount": [
{
"SegmentId": 1,
"SegmentValue": "1001022"
},
{
"SegmentId": 2,
"SegmentValue": "800839"
},
{
"SegmentId": 3,
"SegmentValue": "16"
},
{
"SegmentId": 4,
"SegmentValue": "01"
},
{
"SegmentId": 5,
"SegmentValue": "40"
},
{
"SegmentId": 6,
"SegmentValue": "00"
}
],
"VatCodeId": {
"Value": "04"
},
"AccountNumber": {
"Value": "3046"
},
"Operation": "Insert"
}
]
}

by Magnus Johnsen

Hi,

The issue most likely lies with the customer missing some field. We would recommend posting something else to this customer/create a invoice in the UI with this customer to see if there is any errors that are thrown.

The lines seem fine but are dependant on the endcustomers settings. 

KonsultVn
CHAMPION ***

by KonsultVn


Thanks! I tried linking the customer to a new invoice directly in the UI and received a more detailed error regarding an invalid zip code. It would be greatly appreciated if in the future you could get this error message out rather than the current "Object reference not set to an instance of an object.".

 

It would have made it a lot easier for us in troubleshooting.

KonsultVn_2-1686137182486.png