Mina produkter
Hjälp
tsvensso
CONTRIBUTOR *

Avoiding duplicates when using POST to /api/voucher/create-voucher

av tsvensso

Hi, 

 

Assume creating vouchers using POST to /api/voucher/create-voucher having Control Edge to generate the vouNo (by setting it to -1).

Is there a way in case of communication failures and retries to avoid creating duplicates of a a voucher?

I.e. is there some other field or combination of fields besides serie and vouNo which is enforced to be unique by Control Edge?

 

Best regards

/Thomas

4 SVAR 4
tsvensso
CONTRIBUTOR *

av tsvensso

Thanks Fredrik, 

 

Ok, so no other unique keys then. 

So basically there is no way to avoid duplicates when having CE to create the vouNo?

Instead, the external system must create vouNo in order to be able to do that?

 

Regards

/Thomas

av Fredrik Kurki

Yes, no other PK. Duplicates shouldn't be created if everything is set up correctly. In the 2-3 years we have had this endpoint, we haven't heard of this problem, so it should be fine, but to be really sure, the solution is to let the exporting system set the voucher number as you say., BR /Fredrik

tsvensso
CONTRIBUTOR *

av tsvensso (Uppdaterad ‎18-06-2025 08:03 av tsvensso )

Hi Fredrik, 

Currently we are experiencing a lot of problems with duplicates connected to this endpoint due to intermittent communication problems with CE. Visma support is currently looking into this.
This is not the case for for example the /api/ledger/create-supplier-ledger-with-voucherrows endpoint since we can here use invno as unique key in order to avoid duplicates. 

In order to be able to keep integrations and external systems as dumb as possible by having CE crate vouNo and still be able to avoid dublicates, an improvement suggestion would be to introduce an unique key which does no t include voucher number. 

 

Best regards

/Thomas

av Fredrik Kurki

Hello, the primary keys are Year, Serie and voucher number. BR /Fredrik

Få uppdateringar på det här inlägget i din inkorg

Klicka på de tre prickarna till höger i inlägget/artikeln och välj Prenumerera.

Läs mer om prenumeration här