Create a invoice number

I’m looking for a simple way to create an invoice number that won’t repeat with previous invoice numbers.

There are a couple of ways to do this.

For starters, do you have a fixed increment for the succeeding invoices? e.g. invoice 1, invoice 2, invoice 3

If you use this, you could just either create a number field to store for the total number of invoices (number + increment) or do a search + count (result of count + increment) whenever you create an invoice

In one of our apps, since we don’t have an increment nor do we track the number of invoices, we just use the unique ID and truncate it from end to 5 (or whatever number of characters you want). This removes the hassle of keeping tabs of the number of invoices and the WU that would be spent in either saving the data/searching for the number of invoices

This is my invoice database setup. I just want to be able to create unique number for every invoice created and that number will be stored in the invoice id data field

incremental counting database objects in bubble is hard (see this)

the automatic unique id assigned by bubble can be used as uniqie id only if you use all the characters in it, if you only pick the first n characters the uniqueness it’s not guaranteed anymore

2 Likes

when you create the invoice schedule a backend workflow called “gen_invoice_number”

Use a random # generator plugin so you can have it as an action (opposed to bubbles calculate formula option)

First step:
Gen random number action

Second step:
schedule backend workflow “gen_invoice_number” (only when do search for invoices constrained by invoice number = results from step 1) :count is not 0

Third step:
Terminate workflow
(only when do search for invoices constrained by invoice number = results from step 1):count is not 0

Fourth step:
Make changes to invoice invoice number = results from step 1.

Or count +1 on every new invoice

Thanks for these valuable points @dorilama

Yep, we’ve actually seen this happened already i.e. same string (from n characters of the unique id) but we didn’t think that much of it since the the invoice number was only for formality for us :joy:

This topic was automatically closed after 70 days. New replies are no longer allowed.