Configure Local Notification

Queues or clears a local notification.

Options 

  • Action queues a local notification, or clears an existing queued notification.

  • Name specifies the name of the local notification to queue or clear. You must specify a unique name for each notification.

  • Script specifies the script that runs after the user interacts with the notification. The script also runs when the notification would have displayed if the FileMaker client is in the foreground (FileMaker Go) or if notifications are disabled for the FileMaker client.

  • Delay specifies the number of seconds to wait before queuing the notification.

  • Title specifies the title of the notification alert.

  • Body specifies the text for the notification alert.

  • Button 1, 2, or 3 Label specifies the label for each button in the notification alert.

  • Button 1, 2, or 3 Foreground specifies whether clicking or tapping the button should move the FileMaker client app to the foreground or keep it in the background. If the calculation result is 1 (true), clicking or tapping the button moves the app to the foreground. If the result is 0 (false) or not specified, the app stays in the background.

  • Show when app in foreground specifies whether to show the notification even when FileMaker Go is in the foreground. This option is supported in FileMaker Go only.

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect No
FileMaker Server No
FileMaker Cloud No
FileMaker Data API No
Custom Web Publishing No

Originated in version 

17.0

Description 

Use this script step to display a notification alert after an optional delay. If the user has allowed the FileMaker client app to show notifications:

  • FileMaker Go: Notifications are displayed when the app is not running or is in the background. If the Show when app in foreground option is selected, then the notification is displayed when FileMaker Go is in the foreground as well.

  • FileMaker Pro: Notifications are displayed regardless of whether the app is running or, if it is, whether it is in the foreground.

If you specify a script, the following multiline parameter is passed to the script.

Line number

Parameter value

1

The name of the notification.

2

One of the following values:

  • NotificationSelected - The user clicked or tapped the notification.

  • NotificationNotDisplayed - The notification was not displayed because FileMaker Go was in the foreground.

  • NotificationNotAllowed - Notifications are disabled.

  • <button label> - The user clicked or tapped the specified button in the notification alert.

3

1 if the FileMaker client was in the foreground when the script was queued; 0 if the FileMaker client was in the background when the script was queued.

4

The optional script parameter in the Specify Script dialog box.

Notes 

  • If a new notification has the same name as a queued notification, the previous notification is cleared before the new one is queued.

  • If the user clicks or taps the notification, the FileMaker client moves to the foreground and the specified script runs. If the notification is displayed but the user doesn't interact with it, the script does not run.

Example 1 

Queues a notification without any script or buttons.

Copy
Configure Local Notification [Action: Queue; Name: "BeaconDetected"; Delay: 30; Title: "Beacon Detected"; Body: $beaconMessage;]

Example 2 

Clears a queued notification.

Copy
Configure Local Notification [Action: Clear; Name: "BeaconDetected";]

Example 3 

Queues a notification with a 10-minute delay. Each time the user clicks or taps the Snooze button, the Process Notification script runs again to send the user a reminder after 10 minutes. The following multiline parameter is passed to the Process Notification script when the user clicks or taps the Snooze button:

RemindMe
Snooze
0

If the user clicks or taps the Prepare Now button, the Process Notification script runs the Prepare Report Now script.

Process Notification script:

Copy
Set Variable [ $param; Value: Get ( ScriptParameter ) ]
Set Variable [ $buttonLabel ; Value: GetValue ( $param; 2 ) ]
If [ (ValueCount ( $param ) = 0) or (PatternCount ( $buttonLabel; "Snooze" ) > 0) ]
    Configure Local Notification [ 
      Action: Queue ; Name: "RemindMe" ; Script: "Process Notification" ; 
      Delay: 600 ; Title: "Inventory Report" ; Body: "Prepare the inventory report." ;
      Button 1 Label: "Prepare Now" ; Button 2 Label: "Snooze" ; 
      Button 1 Foreground: True ]
Else If [ Exact ( $buttonLabel; "Prepare Now" ) ]
    Perform Script [ Specified: From list; "Prepare Report Now"; Parameter: ]
End If