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

get next debtorcontact number?


I'm trying to create a DebtorContact for a given debtor. It seems there's no corresponding Debtor_GetNextAvailableNumber for the DebtorContact?

It would be nice if the api in general could just create an instance of a given class, give it an id, and return the id (or allow a query to get the id) - a bit like autoincrement rows in a sql database.

But X_GetNextAvailableNumber is the next best thing.

Is this on your todo list or already possible?

regards, Sune Wøller
created Jun 25, 2010 by sunew
0% Accept Rate
Q 2 A 3 C 0

2 Answers


We have GetNextAvailableNumber on:

IDebtorContact.Create has the attributes debtor object and a name.

You can get the Id of the IDebtorContact vith IDebtorContact.Number, but we don't have a GetNextAvailableNumber on IDebtorContact, but you doesn't state that in the create, so you shouldn't be needing it.

Christian Wendel
answered Jun 25, 2010 by cwe
I was using CreateFromData, and this gives me an

EvaluateException: Got None for nillable(False), minOccurs(1) element (http://e-conomic.com,Number)

If i set Number on the data instance it works. But actually the number is ignored, instead the next number in the row of debtorcontacts is used (just like I want to). But requiring the number and then ignoring it is a little confusing .

My code is (using python):

... authenticate etc. ...
req = DebtorContact_CreateFromDataSoapIn()
debtor_contact_data = req.new_data()
deb_handle = debtor_contact_data.new_DebtorHandle()
debtor_contact_data.DebtorHandle = deb_handle
debtor_contact_data.Name = 'Sune Woeller'
debtor_contact_data.Number = 117
debtor_contact_data.IsToReceiveEmailCopyOfOrder = False
debtor_contact_data.IsToReceiveEmailCopyOfInvoice = False
req.Data = debtor_contact_data
resp = ec.service.DebtorContact_CreateFromData(req)

In the wsdl the Number attribute has minOccurs=1:

s:complexType name=DebtorContactData
s:element minOccurs=0 maxOccurs=1 name=Handle type=tns:DebtorContactHandle/
s:element minOccurs=0 maxOccurs=1 name=Id type=s:int/
s:element minOccurs=0 maxOccurs=1 name=DebtorHandle type=tns:DebtorHandle/
s:element minOccurs=0 maxOccurs=1 name=Name type=s:string/
s:element minOccurs=1 maxOccurs=1 name=Number type=s:int/
s:element minOccurs=0 maxOccurs=1 name=TelephoneNumber type=s:string/
s:element minOccurs=0 maxOccurs=1 name=Email type=s:string/
s:element minOccurs=0 maxOccurs=1 name=Comments type=s:string/
s:element minOccurs=0 maxOccurs=1 name=ExternalId type=s:string/
s:element minOccurs=1 maxOccurs=1 name=IsToReceiveEmailCopyOfOrder type=s:boolean/
s:element minOccurs=1 maxOccurs=1 name=IsToReceiveEmailCopyOfInvoice type=s:boolean/

Note for the interested reader  : All debtorcontacts - independent of debtor - are using the same number series for ids (exposed via the api). In the user interface a different number series is used for each debtors contacts.
Example: my debtorcontact with the global id=3, is debtorcontact number 2 for the debtor.

Regards, and thanks for a really fast reply,
answered Jun 26, 2010 by sunew
Visma e-conomic A/S