1 Reply Latest reply on Feb 10, 2012 9:57 AM by philmodjunk

    Email when date in field is currentdate

    ShaikhAtta1238

      Title

      Email when date in field is currentdate

      Post

      I have a table and it has a field named REMINDERDATE which has a date in it manually given by the user and a STATUS field which has a value 0 or 1. What script can I use so when ever the REMINDERDATE matches the the current date it will check if the STATUS field is 0 and will send an email to xyz@email.com else it will not email. 

        • 1. Re: Email when date in field is currentdate
          philmodjunk

          You actually have two issues:

          1) creating a script that sends the email

          2) scheduling this script so that it is performed at regular intervals.

          How you implement #2 can affect some details in how you write this script.

          Here's a basic script:

          Go to layout [//specify reminderDate table]
          Enter find mode[] //clear the pause check box
          Set field [ReminderDates::ReminderDate ; "<" & Get ( CurrentDate ) ]
          Set Field [ReminderDates::Status ; 0 ]
          Set Error Capture [on]
          Perform Find []
          If [ Get ( FoundCount ) > 0 ]
             Loop
                Send Mail [...
                Go to Record/Request/Page [next ; exit after last]
             End Loop
             Replace Field Contents [no dialog; Reminderdates::Status ; 1 ]
          End If

          1. This script can be set to run each time the file is opened.
          2. If hosted by FileMaker Server, you may be able to use a server schedule to run this script once a day.
          3. A FileMaker "Robot" file can be opened ("run") from an operating system based scheduler such as windows schedule tasks and it can run this script "on file open".
          4. If you leave the window open 24/7 an OnTimer script can perform this script every 24 hours or some other specified interval.

           

          As written, the script does not assume that it will be run every day (which can happen with a script set to run when it is opened.) Thus, it looks for any reminder date with today's date or earlier with a status value of 0.