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

Creating an existing debtor

0
What happen if I create a new debtor with an existing debtor number?

 

        $newDebtorHandle = $client->Debtor_Create(array(
            'number'            => $number, //existing number for debtor
            'name'              => $name,
            'vatZone'           => 'ES'))->Debtor_CreateResult;

 

Will it be overridden? If not, should I get first the debtors by number and if don't exist, create a new one?
created Jul 2, 2014 by msalsas
0% Accept Rate

edited Jul 2, 2014 by msalsas
Q 1 A 0 C 0

1 Answer

0
Hi,

It will not get overridden. It will throw error saying Debtor already exists. Thus you need to first check if Debtor already exists. You can do that using function - Debtor_FindByName() or Debtor_FindByNumber().

To update the existing Debtor you can use the function - Debtor_UpdateFromData()
answered Sep 13, 2014 by Wisdmlabs
Would be really helpful, having an CreateOrUpdate() method, that would save some extra round trips to the server, when synchronizing data from external system to e-conomic.
I searched through the api. I dont think there exists any function such as CreateOrUpdate(). Also when you create a customer on same id then it dont update the customer rather throws an error saying customer already exists.
Visma e-conomic A/S
...