Schedules the display of a notification dialog on screen (and in the notification center)
Dial_ScheduleNotification( switches ; notificationID ; delay ; title ; message ; buttonLabel ; fileName ; scriptName ; scriptParameter )
|switches||(optional) this changes the behavior of the notification|
|notificationID||a unique id for the notification that you can supply|
|delay||the number of seconds to wait before displaying the notification|
|title||the title of the notification|
|message||the message of the notification|
|buttonLabel||(optional) the text of an action button|
|fileName||(optional) the file name where the optional trigger script is located|
|scriptName||(optional) the name of the script to be triggered when the user interacts with the notification|
|scriptParameter||(optional) script parameter|
Switches can be empty or one of these:
|-NoSound||shows the notification without a sound|
|-ShowNotRequired||the OS may decide not to show it when FileMaker is in front (macOS only)|
Data type returned
If successful it returns 0. If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:
|$$-4221||invalidOSVersion||notifications are not supported on this OS version|
|$$-4291||notificationsNotEnabled||notifications are not enabled in the preferences|
|$$-4292||InitializeErr||notifications could not be initialized|
|$$-4293||scriptWontTrigger||(warning only) the script will not be triggered but the notification will be shown|
Troi Dialog Plug-in 7.5
FileMaker Pro 16 to 19
You may need to allow FileMaker to show notifications and specify the alert style in the system preferences.
The optional trigger script is run *after* the notification was clicked (on the notification itself or the action button).
Note that on Windows the script will only be triggered when the notification is shown directly (with delay set to zero). When the delay is not zero the notification will still be shown and a warning code $$-4293 will be returned as a result.
If you specify a script to trigger, a multiline parameter is passed to the script, which will be formatted like this:
line 1 the id of the notification
line 2 <button label> or the status*
line 3 1 = if FileMaker was in the foreground ; 0 = in the background
line 4..n the optional script parameter
*status can be NotificationSelected, NotificationNotDisplayed or NotificationNotAllowed.
Notifications require macOS 10.8 and higher or Windows 8 and higher.
Set Variable [ $ErrorCode ; Dial_ScheduleNotification ( "-Unused" ; "note123" ; 10 ; "Time is up" ; "Your egg is ready!" ) ]
This will show this notification after 10 seconds.
Create the following script:
# First fill in what you want in variables: Set Variable [ $NotificationID ; Get ( UUID ) // set this to an a Universally Unique Identifier (UUID) ] Set Variable [ $DelaySecs ; 5 ] Set Variable [ $Title ; "Notification with Troi Dialog" ] Set Variable [ $MessageBody ; "The notification with Troi Dialog was a success!" ] Set Variable [ $ActionButtonLabel ; "Show me" // is optional ] # Set the trigger script, which is run *after* the notification was clicked. # If notifications are disabled for FileMaker, the script still runs at the scheduled time. Set Variable [ $FileName ; Get ( FileName ) ] Set Variable [ $ScriptName ; "TRIGGERSCRIPT1" ] # Now Schedule the notification: Set Variable [ $ErrorCode ; Dial_ScheduleNotification ( "-Unused" ; $NotificationID ; $DelaySecs ; $Title ; $MessageBody ; $ActionButtonLabel ; $FileName ; $ScriptName ) ]
This will show this notification after a 5 seconds delay. The script “TRIGGERSCRIPT1” will be triggered after the user clicks on the notification or the “Show me” button. In the trigger script you can for example show the user a specific layout.
This example is for macOS only.
Set Variable [ $ErrorCode ; Dial_ScheduleNotification ( "-ShowNotRequired" ; "note345" ; 15 ; "Time is up" ; "Your report is ready!", "Show it" ; Get ( FileName ) ; "ScriptToTrigger" ) ]
By adding the switch “-ShowNotRequired”, this notification will be shown after 15 seconds, but only when FileMaker is in the background. The notification will always be added to the notification center. The script will still trigger and have as second line in the ScriptParameter the status: “NotificationNotDisplayed”.
Used in example file
Related script step