2 Replies Latest reply on Jun 14, 2012 5:06 PM by Malcolm

    Receive an email notification when a record changes

    lsmith

      Does anyone have an idea about how one would create an email notification that would be sent when a record is modified or created? Thanks.

        • 1. Re: Receive an email notification when a record changes
          cortical

          For  a new record, just add a send email step to the new_<record>  script ; you should be using a script for a new record, not letting users use the menu, and not using simple button setups

           

           

          For a modified record, maybe a layout script trigger OnRecordLoad, set a global variable to the modification timestamp ( you should already have an ae_md_ts field), or maybe a better approach to just use the navigation scripting, to avoid 'record load' loops ( should they exist)

           

          Evaluating the change does not want to evaluate every change, or else multiple emails...

          So maybe OnRecordLoad also set a  global variable $$_current_id = current record primary key , or probably with less complications on a navigation change, again all navigation should be scripted,

          with the navigation script  triggered , evaluate the modification timestamp on record go to and go from

           

          evaluating the primary key in some form will prevent an email on nav to same record

          something like this:

           

          nav_email

          #==================================

          #ON LEAVE - PARSE CURRENT VALUES

          #==================================

          Set Variable [ $_last_md_ts; Value:test::md_ts ]

          Set Variable [ $_last_id; Value:test::key_id ]

          #

          #==================================

          #NAVIGATION

          #==================================

          Go to Record/Request/Page[ Next ]

          #

          #==================================

          #EVALUATE FOR LAST RECORD MODIFICATION

          #==================================

          Set Variable [ $_current_id; Value:test::key_id ]

          If [ ($_current_id ≠ $_last_id ) and ( $$_md_ts ≠ $_last_md_ts) ]

          Send Mail [ Send via E-mail Client ]

          End If

          #

          #==================================

          #PARSE NEW RECORD VALUE

          #==================================

          Set Variable [ $$_md_ts; Value:test::md_ts ]

          #

          #==================================

          #TERMINATION

          #==================================

          Exit Script [ ]


          • 2. Re: Receive an email notification when a record changes
            Malcolm

            Does anyone have an idea about how one would create an email notification that would be sent when a record is modified or created?

             

            Filemaker can send an email easily enough, and the script can be triggered by a number of different events. Look at the script triggers in the Help files to see what best suits your purpose.

             

            Malcolm