Jump to content

Script to send email based on date field

Recommended Posts

KassK    0


I have been asked to set up something that will send out email automaticly when the date in the "review date" field is 14 days prior to the current date, can someone help me with a script that would be able to perfom this task? I have also created and email field that will hold the email address.

thank you


Share this post

Link to post
Share on other sites
Fitch    148

Something like:

Enter Find Mode
Set Field[ review date ; Get(CurrentDate) - 14 ]
Set Error Capture [ON]
Perform Find
If[ Get(FoundCount) > 0 ]
  Send Mail
End If


Share this post

Link to post
Share on other sites
KassK    0

Hi Fitch

Thank you for the response, unfortunaly I can't seem to get this to work I am not great at this!!



Share this post

Link to post
Share on other sites
Lee Smith    147

Hi Kassy,

What didn't work? Please explain what it is or not doing.

Why not post a copy of your file so we can see your schema?


Share this post

Link to post
Share on other sites
Fitch    148

Yeah Kassy, we're willing to help but we're not mind-readers. Don't give up. Tell us what's happening.

Share this post

Link to post
Share on other sites
comment    1,390
On 9/13/2017 at 2:01 PM, KassK said:

send out email automaticly when the date in the "review date" field is 14 days prior to the current date

There is no way you can tell Filemaker to watch a date field and run a script when it passes some threshold. The best that you can do is run a script every day on startup, find the records that have passed the threshold and send the notification/s.

You will also want to mark these records and exclude marked records from the find. That way you won't skip a bunch of records when the script did not run for some reason (e.g. on a holiday) nor send a notification twice if you restart.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Who Viewed the Topic

    9 members have viewed this topic:
    ryan360Works  Junior360Works  htmbolton  Lee Smith  Ron Cates  doughemi  FPW  hudi  David Wikström 
  • Similar Content

    • By hutchlad
      Hi Guys, Just a quick question for a beginner, I have created multiple export scripts, and notice that when I create a master script with the numerous subscripts being called, sometimes the output isnt correct, whereas when I run each script one by one (rather than lots of subscripts within a master script) the final result is fine. Could there be anything wrong with using subscripts for this?
      Should I always have an Exit Script step at the end of each subscript? I hope that makes sense
    • By drrehak
      I am using EmailRecipients () , and we have noticed that sometimes duplicate emails are being sent. I had one customer who said they received 10!
      any ideas? My script is:
      Set Variable [ $result ; Value:EmailConnectSMTP("smtp.gmail.com:465";"info@**********.com";"*********";"ssl=1") ]
      If [ $result ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError & ¶ & "Feedback emails failed! Password most likely wrong. Tell Doc."; Default Button: “OK”, Commit: “Yes” ]
      Go to Layout [ original layout ]
      Exit Script [  ]
      End If
      #send email to foundset
      Go to Record/Request/Page [ First ]
      Loop Set Variable [ $first ; Value:patients::first ]
      Set Variable [ $email; Value:patients::email ]
      Set Variable [ $subject; Value:$first & ", Happy Birthday from Colonial Family Eyecare!" ]
      Set Variable [ $msgCreate ; Value:EmailCreate(  "info@************.com";patients::email  ;$subject ) and EmailSetBody( $$body)
      Set Variable [ $setRecipients ; Value:EmailRecipients($email) ]
      Set Variable [ $sent; Value:EmailSend ]
      If [ $sent ≠ 1 ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ; Button 2: “Cancel” , Commit: “No” ]
      End If
      Go to Record/Request/Page [ Next; Exit after last ]
      End Loop Set Variable [ $disconnect ; Value:EmailDisconnect ]
      If [ $disconnect="ERROR" ]
      Show Custom Dialog [ Message: EmailLastError; Default Button: “OK”, Commit: “Yes” ]
      Exit Script [  ]
      End If
    • By docasar
      I have just downloaded the 360works Email plugin Sample and I am doing some tests to check whether this would solve my problem. I would like to be able to download all emails from my email account into "messages" table and then on each customer record show those emails which are related to that customer via a portal based on a relationship between, but what I can not figure out how to do it is that the portal would show but types of emails those marked as "from" emails and those marketd as "to" emails. So far I have created a relationship between Customers::email  ------- Messages::From and the portal would show all "from" messages. If I would set the relationship as Customers:email ------ Messages:To, the portal shows all "to" messages, but what I am trying to make is a join portal that would show by date both "from" and "to" messages, then I plan to make a Conditional Formating saying that if Customers:email = Messages::From then all text in blue, and all text in green when it is TO.
      Is this something that can be achieved?
      Thanks a lot for any tip,
    • By NewBoard
      I have a database, which has two printable forms. One has been designed in portrait, and the other in landscape. Both of them are only ever printed using buttons tied to script steps, never manually. I was hoping that there would be some way to specify orientation via the script. However, after some poking around of my own and light Google searching I am thinking this may not be so easy.

      I am able to go into Print setup to change the orientation just fine, however this sets it for the entire database which is not all around helpful. While specifying the options in the print step, I am able to change orientation. For some reason though, this changes the default orientation across the entire database. Not even while running the script, but just specifying it in the options of the script step. So now I'm at a loss.
      If this is not able to be done, redesigning one of the forms wouldn't be that difficult. But if there's a way to do what I'm trying to do, any assistance would be greatly appreciated!
    • By FileDumb
      Hi everyone,
      I have done some research on this but cannot make headway so any help would be much appreciated!
      I am currently thus:
      • Using FM 13 pro advanced to create a runtime solution for use on Windows 7 PC
      • All well apart from when I go to a script to send an attachment by email... "email client not found" comes up...
      Tried setting the default email client but it doesn't show in default programs in Win 7
      Incidentally this system I created works ok in Mac! (but it won't be used on a Mac so...
      Many thanks in advance,

Important Information

By using this site, you agree to our Terms of Use.