So i have a field called “Lead ID” in the sales table.
I want it to auto increment at database level.
When creating a new thing and using “Current lead id + 1” it does increment, however does it at the current logged in users level. However i want it to increment at the database level irrespective of the user who create it.
So for example, if I have 0 records in the database then
When 1st User creates 2 records, the Lead id will be 1 and 2
When the 2nd user creates 1 record, the Lead id should be 3
Next when the first user again creates a thing, the Lead id should be 4.
Is this possible to do in bubble?
any crm or ticketing system for example will always create new ticket ids irrespective of the user creating it, they are auto incremented at the database level and not at the user level.
Any suggestions to achieve this are greatly appreciated.
Hi there, @sanjeevscode… set aside the fact that someone is likely going to tell you that you don’t need to generate your own ID’s because things have a Bubble-generated unique ID, you should be able to get the desired result by adding 1 to a count of the leads in your database, assuming multiple leads aren’t going to be created at the “exact” same time (which could result in duplicate ID’s).
Thanks for the reply Mikeloc.
However like i mentioned it is not incrementing at the database level. It is doing so at the user level.
This is how i am incrementing when creating a new thing:
Using the above, i see multiple entries with similar lead ids but different created by users.
Infact for each new user when the create a new thing, it starts with 1.
Try Search for Propertys:count + 1. If that doesn’t work, check to see if privacy rules are getting in the way of the search returning all of the properties in the database to get the count.
Happy to hear it worked, but again, you should take the time to read through the great info at the link Keith provided because there is a chance you can get duplicate ID’s by using the count method.
That’s such a great old thread though, right, @troy.roberge?
I reread it today and it’s very entertaining. (Though it’s unfortunate that more recent replies there are guilty of making the same mistakes that are fully explained earlier in the thread!)
I’ve never said one couldn’t have an alternate (shorter, longer, more human-friendly, whatever) ID generated in a different way. But I’d make it unique in a modern way (and, just like Bubble generate it on the client side whenever possible), rather than being based on a count.
(There’s a somewhat hidden feature in List Shifter just for such purposes - “nanoid” operator in Process List!)
I’m also very interested in another unique identifier I ran across recently: Alaska Airlines confirmation codes are short series of alpha characters that almost always “spell something” - not an actual word, but are human-pronounceable and easily memorable. I haven’t figured out how they do that / if it’s from some library, but I’d really like to find out.)
You really should read the thread @keith pointed out and @mikeloc emphasized.
My humble opinion is that unless you truly really need incremental fields (like an accounting system) there are other ways to have incrementing serials.
I personally would use a current date and time formatted to yymmddhhmms been doing that for my invoices for years.