November 10, 200520 yr Hi, Does anyone know how I can go about writing a script that sends an automated email to someone everytime a new record is created. Context: The person who prints the membership cards wants an alert on new members to know when to print the cards. Thanks, David
November 10, 200520 yr Set up your database so that users can only create new records using a scripted button such as the following: Set Error Capture [on] Allow User Abort [off] New Record/Request Pause/Resuem Script [indefinitely] Commit records/Request [no dialog] Send Mail [no dialog; To:"[email protected]" Subject: "New Customer Added "&Docs::Name Message: "New customer named " & Docs::Name & "with ID " & Docs::PrimeDocID & " has been added by " & Docs::CreatedBy & " at " & Docs::Timestamp ] The reason I pause the script is to allow the user to input the data then send an email with pertinent info. Also, although the email is set to send without dialog, the user will still be prompted that Filemaker is trying to send out an email.
November 10, 200520 yr The above example will work but it isn't foolproof. FileMaker is not capable of sending an email message on its own so it uses the default email client application to send the email. On Windows machines this is often Outlook or Outlook Express. Later versions of Outlook will not let another application send a message on its behalf unless the user specifically authorizes the action by clicking a button on a popup window. This can present a problem in a situation like yours. Since the user may not be expecting to send an email as part of the signup process they may just cancel or not allow the message to be sent. The best way around this is to use an SMTP plugin for FileMaker which will give you full control over the emailing process from within FileMaker. I use this method frequently in situations like you describe. This is called work flow management. Using the SMTPit plugin, I am able to have the messages sent without the user's knowledge at all.
November 11, 200520 yr Author SMTPit is already installed on the system to facilitate communciations with the membership base. How do I combine this with the script that Breezer showed in the previous post? Thanks, David
Create an account or sign in to comment