to get a personalized navigation.
to get a personalized navigation.
Greetings 😁 I am using the following endpoint: /controller/api/v1/supplierInvoice
I am attempting to create a Supplierinvoice but am receiving an error message with code 500 that I am unable to interpret. It states: "Error creating supplierInvoice. Object reference not set to an instance of an object."
Are you able to see what is missing/wrong in the following code?
{
"date": {
"value": "2021-05-18T07:01:44.979Z"
},
"description": {
"value": "Fra SAP Ref: 9037155759"
},
"documentType": {
"value": "INV"
},
"dueDate": {
"value": "2021-05-18T07:01:44.979Z"
},
"hold": {
"value": true
},
"invoiceLines": [
{
"accountNumber": {
"value": "1440"
},
"lineNumber": {
"value": 1
},
"operation": "Insert",
"projectId": {
"value": "X"
},
"quantity": {
"value": 1
},
"subaccount": [
{
"segmentId": 1
}
],
"transactionDescription": {
"value": "Fra SAP"
},
"unitCostInCurrency": {
"value": "3090.00"
},
"vatCodeId": {
"value": "1"
}
}
],
"overrideNumberSeries": {
"value": true
},
"referenceNumber": {
"value": "9037155759"
},
"supplierNumber": {
"value": "WXA"
},
"supplierReference": {
"value": "test00100034"
}
}
Solved! Go to Solution.
The solution was to remove validation for the subaccount segment 😁
I have now fixed this issue with the code, but now a different problem arises. I get the error code 400, message: "
Error: An error occurred during processing of the field Subaccount: Error: Avdeling of Subaccount do not exist."
Although the code (with small alterations for suppliernumber and segmentvalue) works just fine when used on another client. I have no problem creating invoices in the UI. The subaccount also exists, here is a part from the /controller/api/v1/subaccount endpoint:
[ { "subaccountNumber": "00", "subaccountId": 107712, "description": "Ingen", "lastModifiedDateTime": "2021-05-12T13:54:35.327", "active": true, "segments": [ { "segmentId": 1, "segmentDescription": "Avdeling", "segmentValue": "00", "segmentValueDescription": "Ingen" } ], "metadata": { "totalCount": 5, "maxPageSize": 1000 } }, { "subaccountNumber": "01", "subaccountId": 107713, "description": "Elkjøp", "lastModifiedDateTime": "2021-05-12T13:54:35.327", "active": true, "segments": [ { "segmentId": 1, "segmentDescription": "Avdeling", "segmentValue": "01", "segmentValueDescription": "Elkjøp" } ], "metadata": { "totalCount": 5, "maxPageSize": 1000 } },
Here is the updated code used in the supplierinvoice endpoint:
{
"documentType": {
"value": "Invoice"
},
"referenceNumber": {
"value": "1000001"
},
"hold": {
"value": true
},
"date": {
"value": "2021-05-19T10:29:27.857Z"
},
"supplierReference": {
"value": "WXA"
},
"description": {
"value": "Test123"
},
"supplierNumber": {
"value": "WXA"
},
"invoiceLines": [
{
"operation": "Insert",
"lineNumber": {
"value": 1
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "00"
}
],
"transactionDescription": {
"value": "test"
},
"quantity": {
"value": 1
},
"unitCostInCurrency": {
"value": 100
},
"accountNumber": {
"value": "3000"
},
"vatCodeId": {
"value": "1"
},
"projectId": {
"value": "X"
}
}
],
"paySelected": {
"value": true
},
"overrideNumberSeries": {
"value": true
}
}
Could you make sure that subaccount:segment/value combination has been registered and available at the lookup table in Financials UI ?
1) Check Subaccounts - ScreenID=GL203000
2)Check Subaccount Segment/Value via lookUp table in the Supplier Invoice
-Select Subaccount Segment by clicking > Press F3 to check available values for this segment.
Thanks.
Hi,
Apart from the values being available in the segment keys subaccount window(ScreenId=CS202000&DimensionID=SUBACCOUNT):
Please also make sure that the subaccount is setup in ScreenId=GL203000:
All these fields are OK.
Still not working 😊
Hello Eirik,
we've emailed you about the further instructions for diagnosing the issue.
Edit:
uncheck "Validation" in the segment and try the operation again.
As Florian mentioned, please include the value of your subaccount as such:
Also, the document type should be "Invoice":
Please correct this and let us know if you are still having issues.
Thank you.
Hi,
I think you try to post subaccount segment without a value...
Florian
Copyright © 2022 Visma.com. All rights reserved.