Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Email upon submitting a record on the IWP side


Recommended Posts

I have a database where people fill out an application on the IWP side and have a custom submit button on the IWP form. When they submit the record on the IWP form, I would like to have an email automatically sent to someone informing them of a new record in the database.


I only want the email to be kicked off when someone submits the record from IWP and not when accessing from FMP.


This is being hosted on FMPSA lastest version.


Any suggestions?

Link to comment
Share on other sites

As far as I know, it is not possible to have Filemaker IWP send e-mails, since the "Send Mail" script step is not web compatible.


The alternative would be to schedule a script to run on a scheduled basis on your Filemaker Server sending e-mails to notify of new records if any.


I hope this works for you!

Link to comment
Share on other sites

Hmm... a script to schedule emails would work just fine.


Can you tell it to check for new records like very 10 minutes and only send out an email if there are new records? Would you be able to give a summary like say: have the email send the first and last name of any new records, so people would know that there is more than one new record and be able to know who the creator was? Could you have the email be sent to multiple email addresses?


Thanks for the suggestion... that would work great, any suggestion on how to script this?

Link to comment
Share on other sites

Well, this might not be exactly right, but it should lead you in the right direction.


First, you need to add a script step to the Button users click once they are done creating or editing records over the web that will set a field on the database with the application version. It should be just like this


Set Field [ YourField; Get ( ApplicationVersion ) ]


Next, you need to create a script that will perform a find on that field for the word "web" (or set a calculation field to have a value like "1" "web" is present) and the current date on the "CreationDate" field.


Now, and once you have located the new records, you need export these records to your desired format and add the exported file as an attachment, you can also use the "Save as pdf" script step if you just need to see the data.


Then you need to insert a "Replace field contents" script step to tell the database that these records have been emailed. You have to create a new field for this to work in a less complicated manner.


Basically, the script would need to look something like this:



Enter Find Mode [ ]

Set Field [ Sessions::zlog_CreateTime; Get(CurrentDate) ]

Perform Find [ ]

Export Records [ ]

[ No dialog ]

Send Mail [ ]

[ No dialog ]

Replace Field Contents [ ]

[ No dialog ]


Good luck!

Link to comment
Share on other sites

I just did this, So I am more than glad to help!



I made a global field called Viewer which holds the string from a GetApplication command that tells FM if the user is in the Application or in IWP.


So there is a line in my LoginScript that executes when someone logs in that looks like this.

Set Field[MainMenu::Viewer; Get ( ApplicationVersion )]

then The script for the submit button could look like this.

If[MainMenu::Viewer = "Filemaker Web Publishing 8.0v1"] 
#You Might need to update this for your version
Set Variable [$WebmailSubject; Value: "Enter Subject Here."]
Set Variable [$WebMailBody; Value: "<b>" & Shots::Project & " " &     
[indent]Jobs::Job## & " </b>has been updated by " & Main Menu::CurrentUser & "."  & "<br><br>"
& "<b>" & Notes::Note Date & "</b>"
& "<br>"
& "<b>Priority : </b>" & Shots::Priority
& "<br>"
& "<b>Status  : </b>"  & Shots::Status
& "<br>"
& "<b>Notes  : </b>"  & Notes::NoteText
& "<br><br>"[/indent]


As you can see I included HTML based page breaks, because your mail program is going to take this information literally.


Then the last line of the script is where the solution lies.

Open URL["mailto:" & Employees:cEmailwithName & "?subject=" & $WebMailSubject & "&body=" & $WebMailBody]

Essentially we are tricking it to think it is opening a URL, and a browser window knows how to handle a long string version of mailto:


I hope that makes sense. I did get it working this way.... if you find others, please let me know!

Link to comment
Share on other sites

Thanks for the replies. I will work on this next week and let you know how it turns out, and i'm sure it will work just fine.


Thanks again.

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Terms of Use