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

Create Creditor



This post is mostly for e-conomic API team.

We are trying to create creditors using the .Net API and are facing the "number required" issue.

I found from the #919 post that the number is required when calling the create method.

In another the #19423 post about debtors it is mentioned that for debtor creation we can either pass "null" as number to get the next automatic value or previously call GetNextAvailableNumber() method.

Can you please implement this behavior for creditors creation as per we are not able to determine the next available value for creditors.

This is critical for us to be able to answer this issue.

Best regards

created Jul 30, 2014 by GuCa
25% Accept Rate
Q 8 A 7 C 3

1 Answer

Best answer
I found out what you probably what you insignuated; that you cannot specify "null" when creating a creditor as you can with a debitor. I have now altered the service, so the same is possible with creditors. It will, though, take a few weeks, before it is released. Till then, you can do something like this:
public static void CreateDebtorWithAutoIncrement()
using (var session = new EconomicWebServiceSoapClient())
var nextCreditorId = session.Creditor_GetAll().Select(p => int.Parse(p.Number)).Max() + 1;
var creditorHandle = session.Creditor_Create(nextCreditorId.ToString(), session.CreditorGroup_GetAll().First(), "auto-incremented", VatZone.EU);
Console.WriteLine("Created creditor with id: '{0}", creditorHandle.Number);
answered Jul 31, 2014 by mortenanders
selected Jul 31, 2014 by GuCa
Hi Morten

Thanks for the fix for the null parameter and the workaround till release.

One last request: can you please update the case when the fix has been released so I will get an automatic notification?

Thanks again for the fast reply and action.
Hi Morten,

I was testing your fix today as per you told me it would take some weeks before availability.

It works fine now. You can pass NULL as creditor number in the Create method and server determines the number.

One question still: the server does exactly the same as the piece of code you provided: which means it takes the higher number used and adds 1. This is in line with the UI way of working. My question is this one: is that normal you do not check whether a lower number is available?
ie: let say i have a range from 1 to 22 and i created a 999 creditor (kind of fake vendor). when i will create a new vendor (via UI or API now) the suggested number will then be 1000. Could be good that the proposed number is 23 instead....this is just a suggestion.

Best regards and thanks again for the fix you did
Visma e-conomic A/S