Create ticket nr

Is there some function in bubble to block so no other person can get the same number ?

    • The input that the user has to enter the number cannot bind to parent element thing.
    • In workFlows Add an Event → Element → An input value is changed.
    • Select the input element that you want to monitor. ie. the input that the number will be entered into.
    • This workflow should only be run when → do search for thing → (search for the thing that has the ticket number attached to it, and constrained it by → ticket Number = this input’s value) → first item is not empty
    • Here you will Add an Action → show groupFocus element (this element show be added to the page befor hand of course. It showld say something like “Number in Use”)
    • Add an Action → Element Action → set focus → set to the current input. (this is so if after they enter the number and click anywhere else on the page it moves the page focus to that element.)

Tip: if you want to prevent the user from saving the ticket number you should create a custom state that only allows the save button to be clicked when that state is true. So you repeat from step 2 - 3.
4. This workflow should only be run when → do search for thing → (search for the thing that has the ticket number attached to it, and constrained it by → ticket Number = this input’s value) → first item is empty
5. Add Action → Element action → Set state-> then select the element with the state assigned and set it to true.

You will also add to the first set of steps and set the custom state to false .

So everytime the element value is changed it will trigger these 2 and if the number is in use it will ask the user to change it. if its free it does nothing (other than making the button used to update clickable)

I think you misunderstood my question. :wink:
I meant that the app generate a sequential ticket no.
And I want to prevent that two users get the same number if they click create at the same time.

@fredrik1

Every time an item is created in the dB, Bubble gives it a unique id.

You can the sort them based on creation date which is also recorded by default.