Duplicate invoice references


#1

Our billing cycle loops through all customers and generates an invoice for them over the API. We’re finding that multiple invoices can be issued the same invoice reference (auto-generated by Freeagent), which is saved fine, but surfaces when we attempt to send the invoice.

When you use the FA UI, it’s not possible to create multiple invoices with the same reference, but yet FA doesn’t prevent this over the API. Again, to clarify, we’re not providing the reference over the API ourselves, this is something that FA is generating and returning.

It sounds like there’s no unique constraint on the reference column in the DB. Is this something that you could look to fix please?


#2

Hi @Gavin_Courtney, Anna from FreeAgent here.

Thanks for getting in touch. We’re aware of this issue and are working towards a fix that will allow us to apply the constraint to the database. Unfortunately it’s quite a complicated problem to solve.

As a workaround, if you can send the invoices one at a time that will allow the current code to correctly calculate the next reference. We understand this is not ideal and are working on a fix for this issue.

We’ll let you know once it’s fixed!

All the best,
Anna


#3

Thanks for the response. I fully understand how difficult it is to answer questions on timescales, but could you give me an indication of whether you think this is days, weeks or months away?

Thanks,

Gavin


#4

Thanks Gavin. As I’m sure you can imagine, there have been a few changes to our priorities recently amidst the coronavirus crisis, so it’ll be several months before we have the fix ready to go.

I’ll make sure to let you know when we get this fix live!

All the best,
Anna


#5

Thanks - that’s helpful to know.

Could you suggest a strategy for how I should clear up the 200+ invoices that are now in FA as a draft with duplicate references? I’ve tried to PUT the invoice with reference=>’’ to force it to auto-update, but get a 400 error. How can I automate the process of putting the next global invoicing sequence against the invoices? I’m really hoping you can suggest something! :slightly_smiling_face:

Gavin


#6

Hi Gavin,

I don’t think there’s a simple way for you to fix it on your end, but we can definitely help from behind the scenes. We should be able to create a script which will allow us to regenerate the references for you.

In order to do this, could you e-mail us at support@freeagent.com and ask to be escalated to the technical team, please?

This way we can discuss the details we’ll need to fix up the data and we’ll walk you through the process of giving our engineers access to the FreeAgent account(s) affected.

All the best

Anna