Beantwortet

Update Auftrag and Bestellung without affecting Positions

  • 12 June 2023
  • 8 Antworten
  • 152 Ansichten

Benutzerebene 1
Abzeichen

Hi, 

 

I’m currently using the AuftragEdit and BestellungEdit endpoints, to update some fields, like for instance the `datum`, but when doing so, the position is being replaced, and creates new ones. 

 

Is that by design ?

Is there any best practice on how the updates are done so that I don’t lose information when using these endpoints ?

 

Best, 

Renan

icon

Beste Antwort von Pau Ferrandiz 21 June 2023, 10:50

Original anzeigen

8 Antworten

Hi @renancidale 

Yes, that sometimes happens with the legacy API. @Pau Ferrandiz  do you know a work-around? 

 

 

Benutzerebene 1
Abzeichen

Hi @chuck_aguilar , thanks for your answer.

 

Is there any other way whether that’s using the API or any other possibility where we can update the records programmatically, without of course overriding existing relationships ?

Benutzerebene 5
Abzeichen +2

Hello @renancidale 

in our legacy standard-api you need to send all positions with your request when usin any of the (Document-Name)Edit Endpoints like AuftragEdit, LieferscheinEdit, etc.

If you don´t send the positions when updating the data, they will be overwritten...in this case deleted.

I hope this information helps.

Benutzerebene 1
Abzeichen

Hi @Pau Ferrandiz , 

Thanks for answering, but unfortunately when that’s done in the AuftragEdit, the ids of the auftrag positions, are new, therefore, the connection between purcahse order and sales orders which is done from purchase order positoin → sales order position is gone. That’s one issue that made us not continue with updating Auftrags, 

The second issue is that when updating Purchase Order, with sending all positions, the side effect this time is that new artikels are created everytime, which then is too confusing to update later on. 

 

I hope that’s all clear, and let me know if there is any other way around. 

Thanks once again,

Renan 

Hi @renancidale 

 

did you try to put the id in the positions? If you put the id, then it shouldn’t happen. 

 

Best,

 

 

Benutzerebene 1
Abzeichen

Hi @chuck_aguilar ,

Thanks for replying, 

Unfortunately I have tried that already and it doesn’t work. 

In pseudo-code what we are currently doing is:

  • fetch the whole sales or purchase order
  • make the update to the record
  • send the whole record back with the update

 

This means that regardless if we are updating something in the sales order, we will also send the sales order positions together, because if you don’t, the positions will be overwritten like @Pau Ferrandiz previously mentioned. 

Best, 

Renan

Hi @renancidale 

 

I can’t help you here further. We will need to wait for @Pau Ferrandiz  who is coming in the beginning of August. 

 

Best,

Benutzerebene 5
Abzeichen +2

Hi @renancidale 

the only workaround in our legacy standard-api is to send all positions with your request. And yes, this creates new IDs for the position items.

I can not reproduce the behavior of creating new items in the system by updating the purchase orders.

 

We are actually developing a new API, as the legacy APIs won´t be updated.
Have you checked the new API Endpoints on https://developer.xentral.com/reference/intro.
 

There is no endpoint for purchase orders yet, but it is planned in our Roadmap.

For sales orders, you can take a look into https://developer.xentral.com/reference/salesorderimport 

 

PS: Please take into consideration that the new REST-API is being developed right now, that means we expect changes on the endpoints constantly and some BETA-Endpoints.

Antworten