Skip to main content
All CollectionsBasics
Update User Action
Update User Action
Patrick avatar
Written by Patrick
Updated over a week ago

Here's how to build a simple function where a new user joining your app must first be reviewed by a manager or admin before they're able to gain access to more secure parts of the app.

First, I set up a simple page with 3 blocks:

A Text block showing my user's name. I entered the following value:

  1. User: {{ user.first_name }} {{ user.last_name }}
    ​

  2. A Text block showing the user's Status (a custom user field), and included a default value of None, by entering this value: Status: {{ user.Status || None }}
    ​

  3. ​A Button block with the 'Approve User' text, and a custom submit action using the 'Update User' action type.

Here's what it looks like in the page builder:
​


Here's what it looks like in live mode when the page first loads. Notice that since my user has no 'Status' currently, it's showing the default value I provided 'None':

After clicking the button, you can see that my user Status has instantly updated to APPROVED based on the action I set up:


Configuring the Update User action:

1. In the Button block (or in any other custom action), click on the action button to open the settings:

2. Click on 'Update Active User' from the list of available action step types:


3. Enter the values you want to update on the active user's profile. This can be for your custom fields or the default fields. All are shown in the input form. In my case, I've only entered one update which is the Status field, and I want to update the Status to APPROVED once submit:


Summary

Storing information about the active, user like the 'Status' field above, will be valuable for your app since it will automatically have access to this data as a data source whenever the user is logged into your app, without needing to make any other additional request to spreadsheets.

You can build apps that update this information in real-time to create sophisticated tools for running your business.

Click here to learn more about User Groups and Permissions


Ideas for Next steps:

If I wanted to make this even more dynamic, I could create a Display Condition on the Button block to only show if the User's Status does not equal APPROVED.

Did this answer your question?