3 Replies Latest reply on Jul 21, 2009 7:06 AM by TSGal

    Script for Email Confirmation - FMP 10

    om_1

      Title

      Script for Email Confirmation - FMP 10

      Post

      Greetings all,

       

      I created an funding application through FMP10 where people can submit their request online (via instant web publishing).  I wanted to know if there's any way for me to automatically recieve an email for every appication submitted?  I'm not sure if I have to create a script that generates an email to me everytime someone clicks submit or what.  I would appreciate any advice.

       

      Thank you in advance!

      OM

        • 1. Re: Script for Email Confirmation - FMP 10
          TSGal

          om:

           

          Thank you for your post.

           

          Yes, it is possible to send an email for every application submitted.  Instant Web Publishing allows you to send an email only through a script via SMTP server.  Also, you will need to create a button to save the information and commit the record.  The browser Submit button commits the record, but it will not execute a OnRecordCommit script step like it would in FileMaker Pro.  Therefore, hide the Status Area and place a user-defined "Script" button.

           

          In FileMaker Pro, create a new field, "NewStatus", of type Number, and set the Option to Auto-Enter the value 0 (zero).  This field does NOT need to be on the layout.

           

          Next, create the following script (WebCommit):

           

          If [ NewStatus = 0 ]

             Set Field [ NewStatus ; 1 ]

             If [ PatternCount ( Get ( ApplicationVersion ) ; "Web" ) > 0 ]

                Commit Records/Requests []

                Send Mail [ Send via SMTP Server ; No dialog ; To: <your email address> ; Subject: <your subject> ; Message: <your message> ]

             End If

          End If

           

          -----

           

          Pull down the File menu and select Layout Mode.  Under the Layouts menu, select "Layout Setup...".  Click the "Script Triggers" tab.  Check the option "OnRecordCommit" and select the script "WebCommit".

           

          On your layout, place a button and have it execute the script step "Commit Records/Requests".

           

          Now, in FileMaker Pro, when you add a record and click this button, the record is committed and the value of 1 is placed into the NewStatus field.  No email is sent.

           

          In Instant Web Publishing, when you click the button, it commits the record which executes the script.  1 is placed into the NewStatus field, and since the ApplicationVersion contains "Web", an email is sent.

           

          This should get you pointed in the right direction.

           

          TSGal

          FileMaker, Inc. 

          • 2. Re: Script for Email Confirmation - FMP 10
            om_1
              

            Greetings,

             

            I hope these few lines reach you in good health and spirits.  Thanks for the prompt response.  I have 3 questions.  With respect to the "Webcommit" script below I was unable to find " ; " for the Set Field [NewStatus ; 1 ] step.  It gave set options ( + , - , <, >, = etc) but it did not allow me to enter ; .  

             

            1) How do I enter ";" ?  (Ex: Set Field [ NewStatus ; 1 ])

              

            If [ NewStatus = 0 ]

               Set Field [ NewStatus ; 1 ]

               If [ PatternCount ( Get ( ApplicationVersion ) ; "Web" ) > 0 ]

                  Commit Records/Requests []

                  Send Mail [ Send via SMTP Server ; No dialog ; To: <your email address> ; Subject: <your subject> ; Message: <your message> ]

               End If

            End If

             

             

            2) Just to clarify... The purpose of this script is to notify everytime some clicks "submit" after completing an online application (that I created via FMP IWP)?

             

            3) In your email you said, "On your layout, place a button and have it execute the script step "Commit Records/Requests"."  I did this step but nothing happened.  Is the button suppose to be connected with the "NewStatus" field you had me create?

             

            I appreciate your support.

             

            Peace & blessings, 

            OM

            • 3. Re: Script for Email Confirmation - FMP 10
              TSGal

              om:

               

              1. A semicolon ( ; ) is a separator.  When you select the "Set Field" script step, FileMaker prompts you to "Specify target field", where you would select NewStatus.  The other prompt is for "Calculated Result".  Here, you enter 1.  Now, the script step automatically displays:

               

              Set Field [ NewStatus ; 1 ]

               

              2. The purpose of the script is to notify you when someone clicks a button in Instant Web Publishing only.

               

              3. Yes, on your layout, create a button.  You may want to draw a rectangle with the words "SUBMIT" inside.  Select the object, pull down the Format menu and select "Button Setup...".  Select "Perform Script", and select the script "WebCommit".  Now, the Submit button is on the layout.  When someone accesses via Instant Web Publishing, the data is committed and an email is sent to you.

               

              TSGal

              FileMaker, Inc.