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

ICurrentInvoiceLineData WITHOUT ref to ICurrentInvoice

0
Hello,
I am using the .NET API with C# with great success.
Although, the performance is really bad, so I decided to cut the number of calls to the server.

I am trying to create an invoice.


Normally it's done;

ICurrentInvoice _order = session.CurrentInvoice.Create(debtor);
ICurrentInvoiceLine _orderLine = session.CurrentInvoiceLine.Create(_order);
// Add Invoiceline data for all invoice lines..
_order.Book()




Now I would like to use the data object.
It all works fine, but I cannot find a way to make a new invoiceline, without making a reference to the ICurrentInvoice?
Shouldn't there be a way to make a new ICurrentInvoiceLineData, [u:1nwf8x7y]without [/u:1nwf8x7y]a ICurrentInvoice?
Because at the place i write HERE below, we do not have any ICurrentInvoice yet.
So then I either need to make a call to the server to make the invoice, but at this point I don't know the gross amount, so the invoice data would be completely wrong. Then I would need to get the invoice back at the end and alter the data. Stupid way, so it cannot be like this
So, please help me - how do I make ICurrentInvoiceLineData WITHOUT any reference to ICurrentInvoice?

ICurrentInvoiceData _order = session.CurrentInvoiceData.Create(debtor);

// HERE..
I would like to do..
ICurrentInvoiceLineData _ild = session.Create.... // or ... new ICurrentInvoiceLineData(_order -- which is a reference to InvoiceData)..
Or...
ICurrentInvoiceLineData _ild = new ICurrentInvoiceLineData();
_ild.Invoice = _order;
_order.AddInvoiceLinesFromData(_ild)
....
yeah.. you got the point..

//Book it and fetch the new object
ICurrentInvoice _orderBooked = session.CreateInvoiceFromData(_order).Book()
created Feb 19, 2013 by olejohan
0% Accept Rate
Q 4 A 1 C 0

1 Answer

0
Unfortunately you cannot create a CurrentInvoiceLine without a CurrentInvoice.

If the CurrentInvoice has been created, you could avoid retrieving the CurrentInvoice object by not going throught the SDK and manually creating the handle for the CurrentInvoice (you just need the invoice id).

But that requires you to change your integration from using the SDK to going directly against the SOAP service.
answered Feb 20, 2013 by nkn
Visma e-conomic A/S
...