Preset the value of a field for all users

My User type has a field “Words List” which is a list of texts. I want this field to initially hold a list of 10 words for every user (and then be able to be edited separately by each user when they use the app). How do I do this?

Thank you!

Hi @joshua.hovden,

You could store the list of texts in a “template” record in your database so that they’re always available to copy from. In your user signup action, you can then set the Words List field.

Words List add list Search for template record’s field

This assumes that the template record’s field is also a list of texts which you can manually save from the back in via Data > App Data.

For the user to edit each individually, do the following:

  • Use a repeating group to display the list of texts to the user. Type = text, Source = Current User’s Words List.
  • Add an input and save button to the cell. The input’s initial content would be “Current cell’s text”
  • The button would trigger “make a change to current user”
  • Words List set list “Repeating Group’s List of texts :find & replace”
  • The find and replace function would find “Current cell’s text” and replace with “Input’s value”

See example here:

Unfortunately, with a list of anything, you can’t just replace the single value. You can add to the list, remove, replace the full list, clear. So, to achieve your goal, you technically replace the list with itself and then use the expression to continue modifying the full list by looking for the old text and only replacing that one with the new.

There’s a very important consideration to take here though. With a plan list of texts, if there are duplicate texts, then the find and replace function will modify all matching texts, which is likely not what you want. If that’s too risky, then the safest thing to do is have the workflow add the new text to the list first in step one and then remove the current cell’s text from the list in step two. Like this:

update%20list

Hope this helps!


Gaby at Coaching No Code Apps (formerly Coaching Bubble)

Courses & Products, Tutorials, Private Coaching, and High-level Development

Start Learning Today :mortar_board:

1 Like

Thanks for the reply! I’m trying to have my app let the user use it without signing up or logging in first, so they would only have to sign up to save any data. Because of this, I want the Words List field to be set before the sign up action, just at the start of any action. Is there another event I could tie this action to besides the sign up action?

You can set it to a custom state, which is like a temporary field that is “saved” to an element on the page. Going to a new page or refreshing clears it, just FYI. If you click the little “i” icon in the upper right of any element’s property editor, you can create a custom state. Use the “Set State” action to save a value to that element’s state.

Is there a way to save the information to the User instead of an element on the page? I would prefer for the User to be able to navigate between different pages and not have their information reset each time.

Once the user has signed up, yes, you can save a custom state’s value to the “Current User’s [field]” with the “Make a change to current user” action. Until the user is signed up, there is no record to save anything to, so it would need to happen after that user exists in the system.

Let me know if there’s some part of your sequence that isn’t connecting though.

In this section of the manual, they describe a temporary user, and being able to save data to the Current User, which will be a temporary user if they haven’t signed up yet. I’m looking for a way to save to the Current User without them having to do anything (like click a button), only open the app. Let me know if I’m missing something here.

1 Like

Yep, you can save data to the current user’s fields even if they don’t login. If you create an account for them later, the data previously saved will show up. Of course you wouldn’t be able to track a user across different devices, browsers, incognito windows, etc., but maybe that is okay for your use case.

1 Like

Ah, yes of course. You can do that too. I think I understood the question differently. Apologies.

So, you could do something like “Make a change to current user: field = xyz” first, and then when they sign up, the new user record will already have “xyz” saved to the field.

No problem! I really appreciate the help.

What action would I tie this to so every Current User has the same values in a certain field when they begin using the application?

Well, technically in that case, you could set the default value of the field so that all new records are saved with it from the start and you wouldn’t need a specific action. You can do this in Data > Data Types:

27-07-00-08

Otherwise, just use the action “Make a change to current user: field = type in your value

1 Like

How can you set the default values of a list of texts?

For that you’ll have to do a workflow when “Page is Loaded” and pull the list of texts from the database in a pre-existing field (like a template record).

Page is loaded > Make a change to current user: List field add list Search for Thing’s List field value

Unfortunately those default fields in Data Types only exist for generic types of single values.