SeedCodeCalendar12

Email Notifications

How can I add Email Notifications to my solution?

Notifications are built into the Pro Calendar, and if you're using FileMaker Server, you'll find this really easy. We have a example script in there that emails resources about appointments coming up in the next x hours. This script can be scheduled to run on FileMaker Server every x minutes and work like a charm. Read through the notes here and then duplicate this set of scripts to use as a model for additional notifications you may need.

First, find the "Email Notifications" folder of scripts and edit the script "Configure Mail Server Settings" to teach the solution about your mail server. Once you think you have the settings correct, run the script "Test Server Configuration" to check it out. You may see an error if you've mistyped something. Keep refining the settings until you get a test message to go though. You'll only have to do this once as all our email notifications use the same settings.

Next, check out the example notification scripts; these really only have two moving parts:

1. Edit the script "Notification 1 - Find Events" to script a find for the records you want to email about. In example 1 this script finds all the events coming up in the next x hours that have not yet had a notification sent. You can run this script on its own to make sure it is finding the right records. Be sure to send a script parameter to it declaring which Source Number you want to search.
2. Edit the script "Send one notification -- message content is edited here --" and you'll see a number of variables you can edit to determine who gets sent the notification and what the message looks like.

That's it. Once you have these calcs the way you like them, you can create a schedule on FileMaker Server to run the notification every so often. You'll have the server run the "main" script: in this example it's "Email Notification 1 - Upcoming Events".

How do I create a Schedule in FileMaker Server?

This is very easy, but beyond the scope of our docs. You'll find step-by-step instructions here (look at page 52 or just search for "script"):

http://www.filemaker.com/support/product/docs/fms/fms11_getting_started_en.pdf

Can I run notifications if I don't have Server?

Yes, but get Server. Your data deserves it.

To run this without server you can always use a "robot" machine: a FileMaker client running a plugin that can triggers scripts every X minutes. If you're thinking about this... get Server. Seriously.

If you want to run the notifications on FileMaker client--as soon as an event is edited, for example-- this can be done, but the user will feel a little pause as the event is emailed out.

Here is how to implement this...

1. You'll use the same configuration script described above, so configure and test your SMTP connection using the "Configure..." script mentioned above.
2. You'll also use the script "Send one notification -- message content is edited here --" described in #2 above, so edit that and make sure it is using the values you want to the recipient, subject, body, etc.
3. Once those two scripts are in hand, you'll call the "Send one notification -- message content is edited here --" script when you're ready to send the notification. Fortunately we're already looking to see if an event has been modified, so you can tie into that to send your notifications.
3.1 Find the script "Close Window & Refresh Calendar" (this is the script we run when you click the "continue" button at the bottom of the Event Details mini window. Edit this script and find the comment "Query our modification tracker". In the next space between script steps add an If / End If pair of steps. The calc for the If() should read:
$sc_UnModified ≠ 1
After that if statement, call your "Send one notification -- message content is edited here --" script. That's it.
4. Caveats. Since users can edit events outside this Event Detail mini window, or even just close that window without running our script, this isn't as reliable as running the script from the server. On the server we search for matching events, no matter how they were edited.

Going Further

If you need help writing additional notifications or automating processes in your solution, get in touch and we can discuss the mods you're interested in and get you a quote.

(855) SEEDCODE
[email protected]
Follow us: