Add a field to record the fact that this notification has been sent and include this field in your find:
Go to layout ["events"; (events) ]
enter find mode [pause:off]
set field [events::eventDate ; "<=" & Get ( CurrentDate ) + 30 ]
set field [events::notificationDate ; "=" ]
Set error capture [ on ]
perform Find [. ]
if [ get ( foundCount) > 0 ]
Replace Field Contents [ no dialog ; events::notificationDate ; Get ( CurrentDate ) ]
#put your code for sending mail here
Thanks for your reply. Would I need to have a notification date field in my table or could I do it without this?
The use of that field allows the system to be self adjusting in cases where the script does not get run or when an event date gets updated.
Without it, the scripted process and your event dates have to always be perfect.
Thanks for your help. the above script performs the find excellently, however the email never seems to come through!
I've tried it in script debugger and everything activates without any errors but an email doesn't land in my inbox.
Any thoughts on why?
Scratch that - I figure it is an issue with my email plugin script - I've tried the above with an email client script and it produces the email - however only for the first of the records found.
Is there a way to produce an email for each found record?
Yes there is and how you set this up depends on what you want to do, whether you run it as a server schedule and whether or not you use an email plug-in.
That's why I didn't spell out the email scripting details
What email method are you using? (I see another question posted that seems to discuss this, but didn't notice if you posted that question. If it's by you, feel free to ignore this reply!)