to get a personalized navigation.
to get a personalized navigation.
Greetings 😁
We are trying to use the /controller/api/v1/purchaseorder/{purchaseOrderNumber} endpoint to update a line on a Purchase Order.
We try to use this simple example:
{
"description": {
"value": "1 HRS a 890,00"
},
"lines": [
{"project": {
"value": "X"
},
"operation": "Update",
"lineNumber": {
"value": 1
},
"inventory": {
"value": "99"
}}
]
}
And we get the error message :
{
"message": "Error: Updating 'Purchase order line' record raised at least one error. Please review the errors.\r\nError: 'Project' cannot be empty.\r\n"
}
This is kind of understandable as when you change the InventoryItem in the GUI the project is removed and set to null.
The problem is however that I can't find any way to change the inventory item. You cant do it in two seperate PUTs (inventory item first and then project) as the first will fail, and if you try to do both in the same PUT like this:
{
"description": {
"value": "1 HRS a 890,00"
},
"lines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"inventory": {
"value": "99"
},
"lineDescription": {
"value": "LN502685/03 - Man hours 50% overtimee"
},
"orderQty": {
"value": 1.0
},
"unitCost": {
"value": 890.0
}
},
{
"project": {
"value": "X"
},
"operation": "Update",
"lineNumber": {
"value": 1
}
}
]
}
Then the line with the inventory will be ignored.
How do you suggest we can solve this? Is the Update operation not able to be used with inventory and we have to insert and delete instead?
Solved! Go to Solution.
Hello again,
We're able to Update the Inventory of the specified Purchase Order Line without the need to set Default Non-Project code "X" in the PUT request, as long as we provide "Order Qty" and "Unit Cost" (If the selected inventory doesn't have the default price).
The default Project should be automatically fetched from ScreenId=PM101000 if it's not overridden.
Could you retry the request with the following payload and see the result ?
1) PUT > https://integration.visma.net/API/controller/api/v1/purchaseorder/xxxxx
{
"lines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"lineDescription": {
"value": "Inventory PUT test line 1"
},
"inventory": {
"value": "1"
},
"orderQty": {
"value": 2
},
"unitCost": {
"value": 890.0
}
}
]
}
Otherwise, as you also mentioned, the best approach would be deleting the Line and Inserting again with the desired information.
I get the same error message. It could be a client issue if you get a standard project X when choosing a new item in the GUI. I do however have the same standard project in the Project accounting preferences.
You've mentioned that,
@Eirik Morken - Proplan AS wrote:
This is kind of understandable as when you change the InventoryItem in the GUI the project is removed and set to null.
It appears being related to these following settings in the company where your integration working at,
If a supplier or inventory item used in the Purchase Order line and its "Expense Account" connected to a "Project Account Group" then the Non-Project "Project X" will not be automatically fetched, and we have to manually enter a "project" value.
This is OK when working in the Financials UI, but when using the API, especially with PUT > Line > Inventory, we are unable to set this value on the fly.
Therefore, you should check the following settings in the UI respectively,
Once Inventory > Expense Accounts are not connected to any Account Groups, then the "Project" field will automatically be populated with Non-Project value as "X"
Otherwise, as we talked, one can delete the Line and Insert a new line again with the desired information
I hope this helps to clarify the situation.
Copyright © 2022 Visma.com. All rights reserved.