Global App Settings Page - How To?

It’s always the most simple things that are impossible sometimes. Wow.

I have a huge bubble app running great in all ways, OTP phone authentication, multiple databases, reusable elements, Admin panel and user interface, you name it. Using all of bubble’s power. BUT…

All I’m trying to do is create a page that lets the Admin set some global settings for the app. AND I CAN’T GET IT TO WORK! My mind is blown.

I’ve created a “Settings” “Thing” (class) and am trying to populate it with one single instance of a thing (object). That single instance has attributes that are the settings.

When my settings page loads, there is no Thing yet created. I have a “Save Settings” button I’m trying to use to save the settings as a new Thing. BUT… I can’t find a way to say “modify a thing IF it exists and create a new Thing if it doesn’t yet exist”. I tried using “Create Thing” and “Modify Thing” in series, one after the other, in the workflow, setting a condition to run “If current Settings is empty”, on the Create Thing tile, then “if current Settings thing is not empty” on the Modify Thing tile.

The result is it keeps making new Settings Things (objects), instead of just staying with the first thing and modifying that.

I cannot for the life of me, figure this simple thing out. It should be dead easy to save some global config settings to a database. But I’m just not getting it.

Can anyone help guide me on how to do this?

PS: Some icing on the cake is that when I do create a new Settings thing, I have another set of buttons to toggle a yes/no part of the Settings thing. That’s not working either for some reason. I think it has something to do with me again trying to test if it exists before the button’s workflow is executed.

Thank you!

When I do a “Do A if X” and “Do B if Y” workflow, I set them up as two separate workflows with the “only when” conditions set at the workflow (rather than step) level.

If I were to run these as separate steps in the same workflow it won’t always work correctly.

Ah! Thank you! I’ll give that a shot.

This is not working at all for me.

I have to be approaching this all wrong.

Currently, I’m making a new Settings Thing and trying to perform operations on it. I can’t even do that.

I can use a button to create a new Settings with user input data for all the fields. This is working.

Then, I use a different button to try to Modify the Settings Thing. Nothing. No changes. It doesn’t matter if I use “Do a search for” or if I use “Current Page’s Settings” to launch the Modify Thing workflow. It doesn’t change anything in the database and the original thing just sits there, unedited. In this case, I’m changing every field in the Settings Thing.

Also, I have a different button. The other button is doing a Modify Thing to change just one field in the Settings Thing. Again, doesn’t matter if I use “Do a search for” or “current page’s Settings”. I cannot change or modify anything in this instance of a thing in the database.

How do other people do app-wide global settings? I HAVE to be doing this the wrong way.

Definitely willing to scrap this approach and do it the right way. Is there a standard approach for setting app-wide values? Like a config file does in regular programming? Or even like a Settings page does in other software (which typically sets a config file behind the scenes)

If you are handling app-wide settings off of the fields in a data entry (or “thing” in Bubblespeak), then the process to create and modify a thing would be the same as any other thing.

As you’ve probably seen the workflow command is “make changes to thing” and then you reference the thing you want changed, and you put in the new value for each field you are changing.

If you are having trouble getting this work, try deconstructing it to its individual parts and testing. For example, if you aren’t sure the workflow is picking up the “thing” you are changing, then put a text element on the page and set its value as the name of that same thing. Then view the page and see if the text element reflects it.

Likewise, put text elements on the page reflecting the “new” values that you want to replace the old values in the thing. Preview the page and see if these reflect what you want.

I mean yeah, this is solid advice. Thank you.

I had just left the database open to look at changes in real time in a different window to verify my Thing isn’t changing at all when I was doing “make changes to a thing.” Which is is bizarre because it’s working all over this huge app just fine for every other type of thing (class) I have. Just not for this particular Settings Thing.

Is this how people typically do global variables or settings in Bubble? With a single instance of a Thing?

If there is a better way, I’m all for it. Otherwise, I may delete this entire page and Thing type from the database and start fresh. It’s almost like some of the mess I had when I was first creating this stuff stuck funny.

Could be a bug – if you are 100% sure you have it set up correctly and it’s not working, then yes try rebuilding the core workflow on another page and see if it works.

You can also use the Bubble debugger to see what’s happening in your workflow steps.

Re: how to people do global variables or settings, don’t know, but if the settings are something you want your users to create or change, then that would be done via saving a thing or things in the database.

And PS also check your privacy settings to make sure that’s not blocking the workflow somehow.

Ok, thanks. Starting that whole page over right now. I named the page “settings” too. Who knows if that’s a prohibited word or something. I’ll try to change everything as I created it over again.

My users won’t be changing the settings. They are global settings, meaning they apply to all people across the app and to the way the app runs itself. Settings are set only but an Admin user (me). So they are truly just a single store of states for a few parameters. These parameters are looked at by the app as it runs to determine what it should be doing.

The result is sort of crazy. I went back in today to look at deleting it and starting over and it was working without any changes. I think it was as bit of data corruption that got normalized overnight.

I had switched between “this page’s Thing” and “do a search for …” and sending different types to the page from the referring page. I had bounded these settings around a lot because I was in a habit of creating pages a certain way and had to correct the habit.

My guess is some of these erroneous choices I made when first setting up the page stuck somehow. Then refreshed at some point overnight.

Anyway, it’s all working fine.

For future reference for anyone finding this on a search, I did global app settings like this:

Created a Settings Page with all options
Tied it into a Thing type called Settings.
Created ONE instance of the Thing called Settings.
Then the trick…
Instead of using “This page’s Thing/Settings” to link your inputs to the database of things, do a “do a search for”, then select “Settings” (which you named your Thing) and then get the “:first one” of the Settings Things for every single iteration you do with the Settings things. It works great and allows you to have just one row of Settings things which holds the settings for your entire app.

What type of data are you saving as settings and how do you expect your users to interact with it?

If the settings are what they seem to be, I would imagine these might be things like the color choices or something else like a User Type that you may use for permissions.

If that is the case, then you shouldn’t use a data type…it requires a search and you are left with doing some wonky dynamic expressions to get the :first thing. This is not an optimized approach in Bubble.

Instead if you are trying to create global variables for the application that would be similar to colors or user types, then you should create those as an option set.

One thing to keep in mind with option sets is you can not create them via workflows, so if you want to allow users to create them via workflows that is not possible, but based on your posts you indicate the use of the data type would have only a single instance of Settings, so it seems you do not anticipate users creating or modifying them, and instead it is something the developer will do, so it is best to put them in an option set.

One thing to be aware of with using colors in this type of way, is that although Bubble lets use use dynamic colors on the element, we can not use them in Styles. When you don’t use styles anywhere in your application, this is not an optimized way of building your Bubble app. Styles are like global settings as it is basically the style sheet for your app. If every element were to have the same formatting options on the element themselves, and you had lots of instances where that formatting is used across various elements in your app, you can only make changes to the color easily as that would be the dynamic color stored in the option set…you wouldn’t be able to change the font family and other aspects of styles easily.

Sorry if my response is way off base and you were attempting to create something very different than what I wrote about here.

Learn More

Boston85719 is an expert Bubbler with a decade experience as an educator. Real name Matthew, he has been actively building SaaS apps, marketplace apps, scheduling apps and more for clients, himself and for sale as templates.

As an official Bubble Bootcamp Instructor, he leads Bubble Bootcamps on a regular basis.

Always willing to offer advice via the Bubble Forum, Matthew also offers Private Personal and Group Training Sessions.

Through his site, NoCodeTrainer, Matthew provides a range of tutorials with editor access to help you jumpstart your Bubble development.

Always accessible you can send Matthew a private message via the forum or send an email directly with your requests.

Be sure to checkout the Stripe Integration Course when you are ready to integrate Stripe payments to start monetizing your application via product sales or subscriptions.

Stripe Integration Course

NoCodeTrainer.com