The body of the alert.
The title of the alert, displayed above the body.
The label of the button of the alert, displayed below the body. If omitted, a default label is used, whose exact wording depends on the language the app has been configured to use. "OK" is used for apps in English.
A promise, which succeeds with no value when the alert is dismissed. Pass this promise as the first parameter to AWAIT (and related functions) to take action after the promise has succeeded.
Displays an alert with the given message. ALERT("Answer: " & Result, "Information")ALERT("Answer: " & Result; "Information") shows an alert with the title "Information" and the body "Answer: ", followed by the value of the text field Result.
This function can only be used from an action formula. It is typically invoked from a formula associated with the OnPress property of a formula button.
The body of an alert is given as the first, and only required, parameter. The title, displayed above the body, is given as the second parameter.
Finally, the label of the single button that appears below the body is given as the third parameter. If a button label is not provided, a default label is used, whose exact wording depends on the language the app has been configured to use. "OK" is used for apps in English.
Alerts require the user to explicitly dismiss them by pressing a button. If you want to show a transient message that disappears automatically, use the BANNER function instead. If you need to ask the user for confirmation, use CONFIRM instead. Finally, if you need to ask the user to provide a text string or a number, use PROMPT or PROMPT.NUMBER, respectively.
Alerts and promises
Functions like EMAILREPORT return a so-called promise, which is used to signal success or failure at some point in the future. EMAILREPORT uses its promise to signal that sending a report either succeeded or failed.
Use AWAIT to take action when the promise succeeds or fails. AWAIT accepts a promise as its first parameter and runs the formula fragment given as its second parameter when — and if — the promise succeeds.
This formula sends a report and shows a banner once the report has been successfully sent:
When sending a report fails, it is often appropriate to show an alert instead of a banner, as an alert needs to be dismissed explicitly by the user and can contain more information. This formula shows a banner when sending a report succeeds and an alert when it fails:
The third parameter to AWAIT has access to more information on the failure,
in the form of a value named
Error, which contains an error
message. The formula above displays the error message in the alert itself.
The ALERT function also returns a promise, which succeeds when the user dismisses the alert. (The promise never fails.)
This formula displays Dismissed using a banner when the user dismisses the alert:
Displays "Hello, world" in an alert, with the title "Greetings."
Opens a report containing all fields of the app and shows an alert if an error occurs.
Shows an alert and then shows a banner when the button is pressed.