2 Replies Latest reply on Aug 19, 2015 10:09 PM by rsjbarker

    Email Alert script

    rsjbarker

      Title

      Email Alert script

      Post

      I'd like to know how I can create an email alert within Filemaker.

      The desired function is for Filemaker to alert me via email when an employees licence is due to expire. For example, I have a database that includes approximately 150 licences that have various expiry dates, the best scenario would be for an email alert to be triggered one month (for example) before a licence is due to expire.

      This alert would be a simple text message (no attachments necessary) that alerted me to:

             
      • FM Record
      •      
      • The Expiry date (based on the relevant Field's expiry information)

      I look forward to any responses that may assist me with this.

      cool

        • 1. Re: Email Alert script
          philmodjunk

          I will assume that you know how to use the Send Mail script step to send out the necessary email.

          I will further assume that each license is a separate record with a field of type date that records the expiry date.

          If so, a script can perform a find for all records with an expiry date within 30 days of the current date. If any records are found, the data from the records of that found set can be emailed. This script could be performed on a regular schedule in a number of different ways. A server scheduled script is the simplest to use, but if this is a local file, the OnFirstWindow trigger could be used to run this script. Other methods are also possible.

          The basic find:
          Go to Layout ["licenses" (Licenses)]
          Enter Find Mode [] --> clear the pause check box
          Set Field [Licenses::ExpiryDate ; "<" & Get ( CurrentDate ) + 30 ]
          Set Error Capture [on]
          Perform Find[]
          If [ Get ( FoundCount ) // Licenses soon to expire or expired were found ]
             Send Mail
          End IF

          If you are using FileMaker 13 or newer, the "list of" summary field might be very useful as a way to pull data from a particular field from every record in your current found set for inclusion in the email. In older versions, you might need to use a looping script to gather the same info. (Copy All Records might also be used.)
           

          • 2. Re: Email Alert script
            rsjbarker

            Thanks Phil,

            I'm out of the office until tomorrow.

            I'll give it a shot.

            Thanks for the info.

            Regards,

            RSJ