Change Data

Actions can be used to alter your app's database— either by creating, updating, or deleting records.

Create Action

Most of the time, when you want users to create new records in your database, you will take them to a screen with a Form where they can fill out information about the record they are creating. However, sometimes you might want the user to click a button that automatically creates the new record without the user having to fill out a form. In the example below, a user is viewing details about a Trip they are planning and the app let's them add new Days to their Trip. Every time the user clicks the "+ DAY" button, another day is automatically added to their trip

To configure your Create Action

  1. Select the collection from your database that the Create Action will add a new record to

  2. You will then be able to specify how all of the properties for the new record should be created. You can use an combination of Text, Magic Text, Numbers, and even Formulas for most properties. For relationships, you can select what they new record should be related to. In this example, we've specified that the new Day record should be related to the Current Trip the user is viewing.

Update Action

As with creating new records, updating a record is often done with a Form. However, there are times when you want the press of a button to automatically change the property on of a record, without the users having to manually make the changes in a form. In the example below, clicking a "Publish" button triggers an Update Action that automatically changes the current Trip's "Is Published" property from False to True.

To configure your Update Action

  1. Select the available record that the Update Action will affect.

  2. You will then be able to specify how all of the properties for that record should be changed. You can use an combination of Text, Magic Text, Numbers, and even Formulas for most properties. For relationships, you can select what they new record should be related to.

  3. For properties that you don't want to change, you can simply leave them set as "No Change"

Delete Action

Delete actions are used to delete records from your database (no surprise there). They can be added to any kind of button as well as icons that are part other components like App Bars and Lists.

To configure your Delete Action, simply choose which record to delete. If the Delete Action is deleting an item inside of a List component, that row will be automatically removed from the list as soon as the user click the icon that you added the Delete Action to.

Add to/Remove from Collection

These actions change how two records are related to each other. For example, if your app has Trips with a Travel Party property that is a relationship to Users, then you can use the Add to / Remove from Collection Action to change whether or not the Logged In User is a member of the Current Trip's Travel Party. Most often, you will want to use a Toggle component to let users configure this relationship, but if you want to use a regular button instead, you would need to add this kind of Action to your button.

To configure your Action:

  1. Select 'Add to/Remove from Collection' from the menu that comes up after pressing 'Add Action' on the component you want to link to the collection

  2. Then select the two Collections that are related. In this example, it would Logged In User and Trips

  3. In most cases, the relationship property that connects the two will be automatically selected, and you're all set, but if you have more than one relationship property connecting the two, you can choose which should be used.