User Settings with an initial value

I am using User Settings to grab the users ID, Group, Permission Level and Supervisor for an app. We are running into issues with users who open the app before their user in our database is created so they are not getting their correct settings. We are filling this with an initial value not a Formula. Our reasoning was being able to edit it on the fly for Demo and Debugging purposes. Would there be a way to either allow us, the developers, to edit our settings but force update other users settings whenever they log into the app. Would reset on edit do this?

There’s no way to push new values to the settings table. The user will have to choose to click save on the Settings view. IF they do re-save the settings page, then RESET ON EDIT could be used.

You can set the initial view to a formula, in UX>Options>Starting View, to send them back to the Settings view if the settings they have don’t match the desired values.

Starting View Formula
IF(USERSETTINGS("setting1")<>"desired value", "Settings", "Other Start View")

Note that the user could still choose to click CANCEL instead of SAVE, so you may want to hide other views or add security filters to limit their access until the settings are updated.

2 Likes

User settings columns work like any other columns, so you could set an Editable? expression that evaluates to TRUE only for developers.

To force an update, set a Reset on edit? expression that evaluates to TRUE for non-developers and set Initial value to an expression that pulls values from the database. Make sure the expression produces a safe default when it can’t find the user in the database.

As @GreenFlux noted, the values in user settings only update when the user saves user settings, just as a row’s normal/non-virtual column values only update when a form is saved.

An alternative to user settings is:

  1. Create a 1x1 worksheet.

  2. Create a table that uses that worksheet.

  3. Add virtual columns to that table that gather the values you want from the database.

  4. Give developers only user settings to override the database values.

  5. Rework the app formulas in (3) to accommodate the settings in (4).

Then a sync is all that’s needed to update the values in that table.

I can force an update to the user settings by using a formula with a lookup to where I want to pull that value from. The purpose of using the Settings is that I don’t have Lookup formulas executing all over my app and it’s cleaner in code.

Wait that just graphically changes the setting but doesn’t change the actual value. That’s kinda bull.