to get a personalized navigation.
to get a personalized navigation.
We're now trying to prepare for next year with the new SalesOrder V3 endpoint and so far it's gone okay.
But when we are trying out the SalesOrder endpoint for creating a new SalesOrder, we are running into an issue regarding subaccounts.
If we omit the subaccount fields, we get this:
{
"details": [
{
"code": "1202-SegmentValueNotFound",
"message": "Subaccount segment values not found: SegmentId: 1 and Value 0, SegmentId: 2 and Value 0, SegmentId: 3 and Value 0, SegmentId: 4 and Value 0, SegmentId: 5 and Value 0, SegmentId: 6 and Value 0, SegmentId: 7 and Value 0, SegmentId: 8 and Value 0, SegmentId: 9 and Value 0, SegmentId: 10 and Value 0",
"parameters": {
"property": "orderLines.subaccount"
}
}
],
"errors": {
"DomainValidation": [
"Subaccount segment values not found: SegmentId: 1 and Value 0, SegmentId: 2 and Value 0, SegmentId: 3 and Value 0, SegmentId: 4 and Value 0, SegmentId: 5 and Value 0, SegmentId: 6 and Value 0, SegmentId: 7 and Value 0, SegmentId: 8 and Value 0, SegmentId: 9 and Value 0, SegmentId: 10 and Value 0"
]
},
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "Refer to the errors property for additional details",
"instance": "/api/v3/SalesOrders"
}
The json input:
{
"customer": {
"id": "0021",
"order": "000113"
},
"type": "SO",
"description": "sample request order",
"orderLines": [
{
"inventoryId": "0001",
"quantity": 4,
"unitPrice": 101.25
}
]
}
If we add the subaccount fields as per the swagger documentation, we get this:
{
"details": [
{
"code": "0003-InvalidValue",
"message": "The JSON value could not be converted to System.Int32. Path: $.orderLines[0].subaccount.additionalProp1 | LineNumber: 13 | BytePositionInLine: 22.",
"parameters": {
"property": "$.orderLines[0].subaccount.additionalProp1"
}
}
],
"errors": {
"$.orderLines[0].subaccount.additionalProp1": [
"The JSON value could not be converted to System.Int32. Path: $.orderLines[0].subaccount.additionalProp1 | LineNumber: 13 | BytePositionInLine: 22."
]
},
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "Refer to the errors property for additional details",
"instance": "/api/v3/SalesOrders"
}
the json input:
{
"customer": {
"id": "0021",
"order": "000113"
},
"type": "SO",
"description": "sample request order",
"orderLines": [
{
"inventoryId": "0001",
"quantity": 4,
"unitPrice": 101.25,
"subaccount": {
"additionalProp1": 00,
"additionalProp2": 000000,
"additionalProp3": 00
}
}
]
}
We also tried inputting the values as both string and integer, same problem.
We have also checked in the company settings if the subaccounts are enabled and existing. (we also saw the other post about this and checked that), and it all seems fine.
in the article information:
in the list of koddelar (GL203000)
And in CS203000 with ID=SUBACCOUNT they all exist there as well.
Creating the salesOrder for the same customer with the same article manually in the UI is working fine.
Solved! Go to Solution.
The solution was provided above, and it was just an issue with how swagger prints out examples.
If it isn't too breaking of a change. Since subaccount can contain a varying amount of segments, wouldn't it make more sense that it was a list instead?
Something like:
[
{
"id": "string",
"value": "string"
},
{
"id": "string",
"value": "string"
}
]
I came across the same problem but i solved it like this and it worked for me, i don't know if it will help you:
Copyright © 2022 Visma.com. All rights reserved.