API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Attention handle issue when saving/updating current invoice

Hi, I have a problem with the Attention handle when trying to save a current invoice.

When I first select debtor (with attention handle set) for the current invoice, and create an invoice with that debtor, it's all good. But then, if I change the debtor (to one that has different attention handle set, or no attention handle set) and try to update the current invoice from data, i get an exception:

Economic.Api.Exceptions.IntegrityException(E06300): The attention of the current invoice does not belong to the new debtor.

Although this exception looks pretty straightforwrd, I am sure that i update the attention handles of the current invoice according to the new debtor that is selected before updating current invoice from data, but I keep getting this exception.

Thanks in advance.
created Aug 21, 2013 by bdn
0% Accept Rate
Q 1 A 0 C 1

1 Answer

Since the attention handle on the current invoice much belong to the debtor, updating these via Debtor_SetDebtor and Debtor_SetAttention won't work - since, regardless of the order in which you call the two, in between the calls, the data will be inconsistent.

However, if you do CurrentInvoice_GetData, update both the debtor and attention, and then return it with CurrentInvoice_UpdateFromData, it should work.

In fairness, though - while changing the debtor of a current invoice is possible, it's not a very typical scenario, so I cannot rule out for sure that your flow can cause problems. Still, if you push the changes together - using UpdateFromData - it's at least _supposed_ to work - if it doesn't, it's a bug :-)


Best regards,
answered Aug 24, 2013 by Christian Estrup
Thank you for your answer.

Actually, that's what I'm doing: getting the current invoice data, updating debtor handle, name, address, postal code and some other debtor attributes, terms of payment, currency, attention handle and reference handle (locally, not on server), and then updating from data. Can I report the bug somewhere?
Visma e-conomic A/S