to get a personalized navigation.
to get a personalized navigation.
In company 2842554 we have purchase order 000045 with one line with a non-stock item. When creating an invoice by hand in the Visma.net GUI, it would be possible to select a ledger and sub account that differs from the proposed values. We wish to do the same using the API.
We created purchase invoice 200354 by posting invoice.json (see below) to /controller/api/v1/supplierInvoice. In the entry line we've chosen ledger account 7120 and sub account 03-91-, which end up in the resulting entry line (screenshot available). Then we updated the invoice using PUT /controller/api/v1/supplierInvoice/Invoice/200354 in which we sent invoice_update.json (see below). The entry is updated and the line is now linked to line 1 of order 000045.
The ledger and sub accounts however are reset to the default values 7110 and 02-91- (the values from the purchase order line; screenshot available). The chosen values 7120 and 03-91- should be kept.
Is it correct to first create the invoice (invoice.json) and after that link the order/receipt (invoice_update.json)? We do this, because linking the order/receipt line in the initial POST does not work.
A workaround was tried to (again) send the ledger and sub account information in the update, but this only works for the sub accounts.
invoice.json
{
"documentType": {
"value": "Invoice"
},
"date": {
"value": "2020-03-07T00:00:00.000Z"
},
"financialPeriod": {
"value": "202003"
},
"supplierReference": {
"value": "Example invoice"
},
"supplierNumber": {
"value": "30005"
},
"currencyId": {
"value": "EUR"
},
"creditTermsId": {
"value": "30"
},
"description": {
"value": ""
},
"note": {
"value": ""
},
"taxDetailLines": [
{
"taxId": {
"value": "3"
},
"taxableAmount": {
"value": 25
},
"vatAmount": {
"value": 5.25
}
}
],
"invoiceLines": [
{
"operation": "Insert",
"lineNumber": {
"value": 1
},
"transactionDescription": {
"value": "Non-stock item"
},
"inventoryNumber": {
"value": "DIVH"
},
"quantity": {
"value": 1
},
"uom": {
"value": "STUK"
},
"unitCostInCurrency": {
"value": 25
},
"costInCurrency": {
"value": 25
},
"accountNumber": {
"value": "7120"
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "03"
},
{
"segmentId": 2,
"segmentValue": "91"
}
],
"vatCodeId": {
"value": "1"
},
"projectId": {
"value": "X"
}
}
]
}
invoice_update.json
{
"invoiceLines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"linkLine": {
"purchaseType": "PurchaseOrder",
"purchaseNumber": {
"value": "000045"
},
"purchaseLineNbr": {
"value": 1
}
}
}
]
}
Solved! Go to Solution.
Hello,
@product_scansys_nl wrote:
The ledger and sub accounts however are reset to the default values 7110 and 02-91- (the values from the purchase order line; screenshot available). The chosen values 7120 and 03-91- should be kept.
By default, the linked Purchase Order selected line's "Subaccount" and "Account" values will be inherited to the to Supplier Invoice's line regardless of its initial values for the Subaccount" and "Account" .
@product_scansys_nl wrote:
Is it correct to first create the invoice (invoice.json) and after that link the order/receipt (invoice_update.json)? We do this, because linking the order/receipt line in the initial POST does not work.
This is correct. This is not possible to link the Purchase Order / Receipt during the creation of the Supplier Invoice (POST).
In order to be able to Link a Supplier Invoice line with a Purchase Order / Purchase Receipt Line,
@product_scansys_nl wrote:A workaround was tried to (again) send the ledger and sub account information in the update, but this only works for the sub accounts.
In this case you can include the "Subaccount" and "Account" values those have been used in the initial POST - Supplier Invoice, again in the PUT - Supplier Invoice (Link Line) Request.
Otherwise, you should set the Purchase Order's "Subaccount" and "Account" values to what is desired to be set on the Supplier Invoice.
PUT > https://integration.visma.net/API/controller/api/v1/supplierInvoice/xxx
{
"documentType": {
"value": "Invoice"
},
"invoiceLines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"accountNumber": {
"value": "7120"
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "03"
},
{
"segmentId": 2,
"segmentValue": "91"
}
],
"linkLine": {
"purchaseType": "PurchaseOrder",
"purchaseNumber": {
"value": "000045"
},
"purchaseLineNbr": {
"value": 1
}
}
}
]
}
In this case you can include the "Subaccount" and "Account" values those have been used in the initial POST - Supplier Invoice, again in the PUT - Supplier Invoice (Link Line) Request.
We tried that, but this only works for sub accounts, not for the ledger account. Could this be related to the sequence of actions? If the information in the PUT request is processed in a certain order and linkLine is processed after accountNumber, then that could be the cause.
Should we then perform two updates, one to link the purchase line, then one to set ledger and sub accounts?
Unless there is another process is affecting the values of the supplier invoice in between those processes, (such as changing the project, vat category, supplier, item etc after link line) the order of the field / values set in the JSON should not be the case.
We've tested that scenario and in both cases we're able to set the Account and the Subaccount when making a PUT request with the Link Line.
Assuming that you already have the Purchase Order in place. (As mentioned, you can also try updating the PO's Subaccount - Value before linking with the Supplier Invoice) which will be inherited to the Invoice)
1) POST a Supplier Invoice with the item in the line going to be linked with the Purchase Order
2) PUT Supplier Invoice > Link Line (Including Subaccount & Account Value)
Please edit the following reference fields with the data from your company.
{
"documentType": {
"value": "Invoice"
},
"invoiceLines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"accountNumber": {
"value": "7120"
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "03"
},
{
"segmentId": 2,
"segmentValue": "91"
}
],
"linkLine": {
"purchaseType": "PurchaseOrder",
"purchaseNumber": {
"value": "000045"
},
"purchaseLineNbr": {
"value": 1
}
}
}
]
}
Also make sure the desired "Account" is available (ScreenId=GL202500) and can be used for your flow scenario. (VAT / Non VAT etc)
I've tried this several times, but the ledger account simply won't change to 7120, while changing it by hand is possible, so we know the account is valid. For example invoice 200358, which was linked to order line 1 of order 000049 and of which the sub account was changed to 03-91- by a PUT with the JSON below:
{
"invoiceLines": [
{
"operation": "Update",
"lineNumber": {
"value": 1
},
"accountNumber": {
"value": "7120"
},
"subaccount": [
{
"segmentId": 1,
"segmentValue": "03"
},
{
"segmentId": 2,
"segmentValue": "91"
}
],
"linkLine": {
"purchaseType": "PurchaseOrder",
"purchaseNumber": {
"value": "000049"
},
"purchaseLineNbr": {
"value": 1
}
}
}
]
}
Have you also tried, updating the Purchase Order Line's Subaccount(03-91) & Account (7120) values before linking with the Supplier Invoice ?
No, but I trust that would indeed work. We are however only interested in creating/updating the purchase invoice and not in updating the purchase order or receipt.
I have found a workaround in using a second PUT to set the ledger and sub accounts. So after the initial POST:
This might be related to the company settings. We'll test some additional scenarios to see if this can be done in the initial PUT - Link Line request for you.
Could you please share print screen from the Selected Inventory & Supplier's > General Ledger Accounts Tab (developersupport@visma.com)
Second PUT should definitely work, thank you for sharing.
Have you had a chance to do these tests? I am currently doing maintenance on our template configuration for Visma.net and am wondering whether to add the workaround (the second PUT) or not.
Hello,
This is working as how the endpoint is designed at the moment, therefore currently, a second PUT request should be sent to update the mentioned fields.
The screenshots were sent to the email address. In our GUI Supplier = Vendor.
These are the before and after print screens:
Before Linking
After Linking
https://community.visma.com/t5/media/gallerypage/user-id/346824/album-id/61797/image-id/73584i908C39...
https://community.visma.com/t5/media/gallerypage/user-id/346824/album-id/61797/image-id/73583i56A677...
Copyright © 2022 Visma.com. All rights reserved.