Jump to content
Sign in to follow this  
ibabs

Email alert sent based on a date field

Recommended Posts

Hello...

my question is....

I have a database where occasionally some spec information sometimes will be changed ...The problem is, I am told that may happen a few months in advance from it actually happening. I made a notes field to hold that info (the changes I need to make) and a date field to show when the change needs to happen. I would like when that date field = the current date, that it sends me that email and picks up that notes field for the body of the email.

I can figure out how to do the last part, (pick up the notes field for the body of the email) but I can't figure out how to tell the computer that when the date in that date field = the current date, have the email automatically send to me....

I would appreciate any guidance here..

thank you......

babs

Share this post


Link to post
Share on other sites

You'll need to have a "drone" computer running FMP that runs the script and checks.

Alternatively, set the script to startup so it runs each time a user (or just you) log-in.

Share this post


Link to post
Share on other sites

hi,

thanks for the reply.....

I actually have the following script (see below) and it's weird, because I brought the database home to work on, and it did open and send me the email message in that notes field....but, since I opened the file and I have the date field (which I tested using todays date) set to = current date, well, that means the user would have to make sure the database opens on that exact date. I would assume, if you see my script, that if I opened the database tomorrow it wouldn't do anything...so, I think I'm close, but it needs to work even if someone doesn't open the database on that specific day. For example, what if it's a weekend or holiday, and that is the date the date field that would launch the email on open.. ..it won't work... so, see my script below and if you have any ideas. I'm all ears.. thanks

open database

Go to Layout [ “Mag_Job_Entry” (mag_Insertion_Orders) ]

Adjust Window

[ Restore ]

If [ mag_Specs::mag_email_date = Get ( CurrentDate ) ]

Send Mail [ To: "barbara.press@tiffany.com"; Subject: "Spec changes alert"; Message: mag_Specs::mag_Notes ]

End If

what do you think ;-)

Share this post


Link to post
Share on other sites

You probably need another field to mark whether an e-mail has already been sent.

Perform a find for records what have date due <= today AND haven't already had an e-mail sent.

Share this post


Link to post
Share on other sites

Hi Vaughn,

OK...that will take some time for me to figure out, but it makes perfect sense.... So, I will give it a shot..thanks!

babs

Share this post


Link to post
Share on other sites

Put the script step:

Set Field (DateEmailSent to get (currentdate) right after the send mail step.

Also, after you find the records that need to be sent, you should loop thru the found set, sending emails and marking them as sent.

Share this post


Link to post
Share on other sites

hello,

thank you... I did try to put that step in, but it says function doesn't exist?

any thoughts??

thanks!!!

babs

Share this post


Link to post
Share on other sites

Hi babs, and welcome to the Forum.

You should not receive that error for this:

Set Field [ DateEmailSent; Get ( CurrentDate ) ]

Perhaps it is how you are putting it into your script.

Print the script and paste a copy of it here.

HTH

Lee

Share this post


Link to post
Share on other sites

hello Lee and thanks for the nice welcome....

Here is what I would have after putting that line..in... OK, the first time I didn't have the brackets ...I'm very new to this, so please bare with me..... now that I put it in exactly as you gave it to me, the message is: "The specified table can't be found"..

Should the notes field and date field be in their own table?:

here is what I have now..

Go to Layout [ “Mag_Job_Entry” (mag_Insertion_Orders) ]

Adjust Window

[ Restore ]

If [ mag_Specs::mag_email_date = Get ( CurrentDate ) ]

Send Mail [ To: "barbara.press@tiffany.com"; Subject: "Spec changes alert"; Message: mag_Specs::mag_Notes ]

Set Field [ DateEmailSent; Get ( CurrentDate ) ]

End If

BTW-I'm glad youi are happy to help... I could certainly use it ;-)

thanks!

babs

Share this post


Link to post
Share on other sites

The script worked for me, as revise for my file.

I did reverse the order Send and Set Field.

Go to Layout [ original layout ]

Adjust Window

[ Restore ]

If [ Gary::mag_email_date = Get ( CurrentDate ) ]

Set Field [ Gary::DateEmailSent; Get ( CurrentDate ) ]

Send Mail [ To: "barbara.press@tiffany.com"; Subject: "Spec changes alert"; Message: Gary::mag_Notes ]

End If

HTH = Hope this Helps

And I hope that barbara.press is a false address, as I sent her an email using the script.

HTH

Lee

Share this post


Link to post
Share on other sites

Hi lee,

hmmmm. no errors and looks pretty good....

I'm diving into it somemore, as I still have other stuff to finish up.

I'll keep you posted!!!

thanks for you help... I really do appreciate it!!!!

enjoy the holiday weekend,

babs

Share this post


Link to post
Share on other sites

I was waiting for you to report back.

What is your purpose the Adjust Window step? I don't really see a need for it, but maybe I'm missing something.

Lee

Share this post


Link to post
Share on other sites

hi lee,

Yeah...I am playing with this in-between my other work, that is why it took so long to get back to you...

The window step seems to just resize the window to fit nice on the screen. I use it everytime I go to diffetent screens..seems to do the trick ;-)

babs

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
Sign in to follow this  

×

Important Information

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