Create a Button or Link that Updates a Field to a Custom Value

Scenario

You would like to have a single button or link that updates a field to a custom value when clicked. This creates a one-click process that allows users to make quick updates and prevents them from inputting the wrong information.

Some example use cases of this would be:

  • A button that approves a project or event

  • A link that updates the status of a contact in a sales pipeline

  • A link that marks an invoice as paid

To do this, you'll use a form with a record rule to set the value but remove all fields or use action links in views.

Requirements

If this is your first time creating an app, you'll need to know some basics about adding tables, fields, pages, and views. You can start by reading our Builder Basics section. 
Other good resources can be found in our About Your Database and Working With Pages article in our knowledge base.

Steps

In this example, you will create a button and link that approves a Project. 

Create a Project Table

In the Data section of the Builder, create a table to store your Projects.

For this example, you'll need at least one field for the Project's name, but you can feel free to include any other fields you'd like:

 

Add a Status Field

In the Projects table, add a multiple-choice field and name it "Status." This field will track whether a Project has been approved or not.

Include the following options:

  • Pending Approval

  • Approved

  • Rejected

Set the Default Option to "Pending Approval" so that all new Projects created are automatically set to that status:

 

Create a Projects Page and Grid

In the Pages section of the Builder, create a page with the following settings:

1. Using the Projects table as the data source

2. A grid and links to view more details for each Project (See details view screenshot below.)

3. Call the page "Projects":

 

Add the Button/Link to Update the Record

Button: Update the Record With Record Rules on a Form

1. Go to the Project Details page you created.

2. Add a new form for editing that page's Project.

3. Click on the new form to open the view editor and access the form settings.

4. From the settings section of the view editor, rename it to "Approve Project."

5. Remove all fields from the form by clicking on the trash can icon for the field.

 

 

Add a Record Rule

1. Go to the Form Rules section.

2. Click on the Record Rules tab.

3. Click the Add Rule button.

4. Set up the record rule as follows:

  • Action: Update this record (the default option)

  • When: Every form submission (the default option)

  • Values: Set "Status" to a custom value "Approved"

 

You can read more about using and managing record rules here.

Link: Update the Record with Action Links

It's also possible to use action links to add a link to views to trigger an action. In this case, we want to trigger an action that approves the Project record.

For the grid view in your app displaying Project records, open the view editor and select "Add Columns" and then "Actions".

There, you can choose to add a link to "Trigger an action".

 

 

Once your action link is added, you can then define what action your trigger will execute. In this case, we want to set the status field to "Approved". This will add a new column to your grid with the link to approve the record.

 

You can read more about using and managing action links here.