Actions can be used to alter your app's database— either by creating, updating, or deleting records.
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.
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 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.