How to use database triggers to update full names
In this Bubble tutorial video, I'd like to demonstrate how database triggers can be really helpful when dealing with first names and last names.
Unlock the power of database triggers: Learn how to automatically update full names in Bubble!
Say goodbye to manual updates: Discover how to keep data in sync effortlessly with this Bubble tutorial.
Optimize your Bubble app: Master database triggers to streamline workflows and improve efficiency.
Introduction to Database Triggers in Bubble
In this Bubble tutorial video, I'd like to demonstrate how database triggers can be really helpful when dealing with first names and last names. I've got a repeating group here and I've got a list of contacts. I've got a first name field and a last name field. So if I was to update this first name say to Alfred, you can see that my label here updates and that's because my label is simply two dynamic values my current cell's contacts first name and my current sales contacts last name.
The Benefits of Using Database Triggers
But you might have a good reason in your app why you'd want to have the full name in your database and you could do that through workflow when you modify it but database triggers basically mean that you've got one less thing to worry about one less chance that you'll miss keeping data up to date and in sync with one another.
Setting Up Database Triggers in Bubble
So let me demonstrate to get to database triggers you need to be on a paid Bubble plan and a back in workflows enabled and we can go in and general new database trigger event and so let's say this is update full name and contacts and so what we're going to do is make changes to a thing and database triggers give you access to the data before and after this trigger occurs.
Configuring the Database Trigger
So we're going to make changes to the one after and we're going to change the field of I'll just put in full name and full name is going to be the contact after we've updated either the first name or the last name. Now you could use this contact or you could use contacts now it doesn't make any difference and we'll say first name and we will also trim this to remove any additional spaces that the user might leave after the name otherwise we'd end up with a double space in the middle. We click there we have a space of our own and we go contacts now last name and we also trimmed that.
Optimizing Workload Units
Now with regards to workload units we want to optimize this and at the moment this database trigger will run every single time anything changes with a contact and I can limit that down so I could say only when the contact before change first name is not contact now first name or contact before last name is not contact now last name. So you know my contact could have 20 other fields it could have email address it could have option set fields in there but I don't want to update full name every single time one of those fields changes I'm limiting it now just to when either first name has changed or last name has changed.
Updating the App Interface
So let me update the labels in my app so to instead say full name and refresh that. Okay so at the moment they're empty because the database trigger has not been run so maybe you'll want to consider saving it at some point depending on when your database trigger runs you might need to populate full name value first but you'll see that if I update this back to Bruce and click out my full name is populated there as Bruce Wayne I can do the same for Tony so I could put in pepper okay and the field is updated.
Important Considerations for Database Triggers
A couple of things to say about database triggers that's really worth being aware of I go back to back end. So database triggers run in the back end because they're a back end workflow. They in my experience when you run a lot of database triggers at the same time say you've imported a CSV file with a hundred entries and you're running a database trigger on each those entries in my experience it can be a little bit iffy it can fail there's definitely an element of Bubble queuing the database triggers it doesn't happen instantaneous on the front end so I'd just be aware of database triggers when you're handling large amounts of data and you're kind of pushing through so hundreds of entries in one go that all have a change like this going on I'd just be aware of that.
Limitations of Database Triggers
The other thing to mention with database triggers is that they can't trigger each other so I couldn't now add in a database trigger that says when full name changes do this action because the full name change occurs in the database trigger having said that that would run if you updated full name in a workflow elsewhere in your app what I mean is that full name the change to full name here is not going to trigger a database trigger that is looking for changes on the full name field.
Conclusion
So there you have it that is a summary and an illustration of one helpful thing that you can do and make use of database triggers if you've got any questions about database triggers do leave a comment if you've got any requests for further videos leave a comment also we look and try and respond to every single one.
Get the Complete Bundle for Just $99
Access 3 courses, 390+ tutorials, and a vibrant community to support every step of your app-building journey.
Start building with total confidence
No more delays. With 30+ hours of expert content, you’ll have the insights needed to build effectively.
Find every solution in one place
No more searching across platforms for tutorials. Our bundle has everything you need, with 390+ videos covering every feature and technique.
Dive deep into every detail
Get beyond the basics with comprehensive, in-depth courses & no code tutorials that empower you to create a feature-rich, professional app.
Save over 70%!
Valued at $80
Valued at $85
Valued at $30
Valued at $110
Valued at $45
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
We're here to help you launch your no code SaaS. Reach out to the team and we'll double check our vast library for useful content. We'll advise you on how we'd tackle the same problem and there's a good chance we'll record the video to help the wider community.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.