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 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 (e.g., 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 app 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 you can create in your app, other actions 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 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 app editor) or that allows users to delete records. You can alternately long-press any row to enter selection-mode.
- 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.
- 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 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 app 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 to which the action applies
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
App: Copy this row and edit the copy
Copies the current row and opens it in a form view.
App: 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.
App: Export this view to a CSV file
Downloads the rows in the current view to a CSV file. This action only works on desktop browsers and not in iOS or Android apps. See these example apps for a demonstration:
You may also be interested in CSV email templates, which allow you to send CSV files over email.
External: 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])
External: start an email
Opens the email app on the device running the AppSheet app.
To: The intended recipient of the email.
External: start a phone call
Opens the phone app on the device running the AppSheet app.
To: The intended recipient of the phone call.
External: start a text message
Opens the messaging app on the device running the AppSheet app.
To: The intended recipient of the message.
Message: The message to send
External: Open a file
Opens a viewer for a file on the device running the AppSheet app.
To: The file to open.
Data-Change Action Types
Data: Execute an action on a set of rows
This bulk action option is an expression based version of bulk select. This automated version selects the rows using an expression rather than a user, such as yourself, selecting the bulk actions via your applications user interface.
To use this action there are a few items you'll need to become more familiar with. First, review the "Changing Multiple Data Values in Another Table" section in this document on Changing Data from a Workflow Rule. Second, review the SELECT() expression. Understanding how both elements work in concert with each other will allow you to execute this feature quickly to help you scale your process.
Data: set the value of some columns in this row
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.
Data: delete this row
You can use this action to delete the current row.
Data: add a new row to another table by using values from this row
By creating a new Action and specifying which separate table data should be added to and defining each column added, rows of data can quickly be updated and moved across all tables in your application.
The Action setup shown below produces the effect of copying the Email and Course values from the student table, and using the TODAY() and TIMENOW() expressions, to log the Email, Course, current date and time as a new row in the attendance table:
Composite Action Types
These actions are constructed by composing existing actions in two different ways.
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.
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 make changes to many rows that are related to the current row. For example, to delete all the components of a part.
You can learn more about Actions in this video: