Actions are a customizable part of your app's Behavior. The Actions described in this section are operations that can modify data in your app (Data Change actions) or navigate to a different part of the app (UI Navigation actions). A third category of action (External Communication action) is integrated with the Workflow Rules and is described in that section.
There are three types of actions:
- UI Navigations: when such an action is run, it shows the end-user a new view within the app (or of another app).
- Data Changes: when such an action is run, it changes (adds, deletes, updates) some part of the data used by the app.
- External Communications: when such an action is run, it causes some information to be sent to an external service (eg: a push notification or an SMS message).
The app definition includes definitions of actions in these three types.
You can add actions to your app in the Behavior > Actions part of the editor. These actions can be extremely helpful in accomplishing a variety of different tasks with your app, from email to copying a row. It's also possible to execute a sequence of actions.
Besides the actions that you can create in your app, there are other actions that are automatically created. You can learn more about System Actions and how to control them.
Not only can you create actions, you can also configure them to run when certain view navigation events happen using View Events.
Where do Actions appear in the app?
In the Detail view (previously Slideshow view), a button is shown for each action in your app. When the button is tapped, the action is triggered.
In the Table, Deck, and Gallery views, actions can be applied in bulk to many rows at one shot.
To use bulk actions:
- Enter selection-mode by pressing the select button on a Table, Deck, or Gallery view that has one or more actions (Data > Actions in the editor) or that allows users to delete records. You can alternately long-press any row to enter selection-mode.
2. Once in selection mode, tap on some rows to select them. As you select rows, actions will appear on the top right corner of the screen. Note: only actions that are valid for all selected rows will appear.
3. Finally, tap an action to update all the selected rows. If the app has delayed sync enabled, the changes will be queued, otherwise a sync will be triggered.
Where can an action run?
All AppSheet apps run on a device or in a browser. However, all these apps are actually hosted from the AppSheet cloud service (also called the AppSheet "backend") so some actions can also run in the cloud service.
- UI Navigation actions can only run in the app on the device or browser.
- Data Change actions can run in the app or in the cloud service. The app data is accesible at both locations and therefore can be changed at both locations.
- External Communication actions only run in the cloud service. This is point-in-time implementation limitation. These actions may be supported in the app as well in the future.
When does an action run?
Every action has to be "triggered" by some event that causes it to run. As the app creator, you get to control these triggers.
- By explicit user invocation: you can define an action to be shown as a visual icon or button. When the user taps or clicks on the icon or button, the app invokes the action.
- By implicit user invocation: every view in the app has some standard behaviors when a user interacts with the data in the view. For example, when a user taps on a row in a Tabular view, that specific row is shown in detail in a Detail view (previously Slideshow view). By default, the "tap-on-row" event triggers a system-defined UI Navigation action that takes the user to the new view. As the app creator, you can control some of these triggering events associated with each UX view.
- By automatic invocation in the cloud service: the app can define Workflow Rules that run in the cloud service and execute actions when specific changes occur or on a schedule.
How to Create Actions
Actions can be added in the Behavior > Actions part of the editor. Each action definition includes the following components:
Name: The text shown by the action button
Icon: The icon shown in the action button
Table: The table that this action applies to
Condition: (optional) The action will only be shown if this expression results in a "true" value. If left blank, the action will always be shown.
Type: What will happen when the action is triggered
NeedsConfirmation: Show a popup confirming the action when the user taps the action button
Prominence: AppSheet will automatically show the actions throughout the app: this option controls how visible actions will be in the app.
Other: Depending on the type, other options will be available.
Navigate Action Types
1] Go to a website
Navigate to a URL of your choosing.
NavigateTarget: The URL to navigate to when the action is triggered. This can be an expression to compute the URL that will be run at the time the action is triggered.
- Google searching a value from the row: CONCATENATE("https://google.com/search?q=", [Search Column Name])
2] Go to another view or app
Open a different AppSheet app, or go to another view in the current app.
NavigateTarget: The App deep link to navigate to when the action is triggered. This can be an expression to compute the App at the time the action is triggered. This uses the same structure as the app column type.
3] Copy row
Copies the current row and opens it in a form view.
4] Send an email
Opens the email app on the device that is running the AppSheet app.
To: The intended recipient of the email.
5] Make a phone call
Opens the phone app on the device that is running the AppSheet app.
To: The intended recipient of the phone call.
6] Send a text message
Opens the messaging app on the device that is running the AppSheet app.
To: The intended recipient of the message.
Message: The message to send
7] Open a file
Opens a viewer for a file on the device that is running the AppSheet app.
To: The file to open.
Data-Change Action Types
1] Set the value of a column
With this action type, you can set or update the value of a field on the current row.
Column: The column to be updated when the action is triggered
Value: The value to set the column to when the action is triggered. This can be an expression to compute the value that will be run at the time the action is triggered.
- Marking a task as complete
- Updating a ticket priority
- Assigning a record to someone
- Adding or subtracting a number
- Setting a date or time to the current time
- Setting a Lat/Long column to HERE()
You cannot set the value of a column that:
- Contains an AppFormula
- Is a ChangeCounter, ChangeLocation, or ChangeTimeStamp column
Check out the Maintenance Overview app for an example.
2] Delete the row
You can use this action to delete the current row.
Composite Action Types
These actions are constructed by composing existing actions in two different ways.
1] Execute a sequence of such actions on one row (Composite Action)
Run some of your other actions, one-by-one, in order. This can be used to do multiple things when an action button is pressed.
Check out the Equipment Inventory app for an example.
2] Execute an action on a set of other rows (Reference Action)
identify a set of other rows using an expression and run a pre-defined action on all of those rows. This can be used to do make changes to many rows that are related to the current row. For example, to delete all the components of a part.