3 Replies Latest reply on Mar 28, 2012 7:04 AM by karendweaver

    OnRecordLeave / Exit


      Hi All,


      I'm trying to work out a way to trigger a script that will set the values in various fields to a default value, even though they can be quite rightly changed by people through the course of general interaction. I'm essentially looking for an OnRecordLeave or Exit trigger.


      The reason I'm asking is that in my DB, various options that affect summary fields can be set for a record. The problem is that those options are then saved with the record which affects other related records... you may then say "then your relationship is wrong". But for reasons I wont bother with, these relationships can't be altered.


      Any ideas?


      - Matt

        • 1. Re: OnRecordLeave / Exit

          There is an "OnRecordCommit" script trigger available for layouts that will run a script any time a record is committed. That could go through and reset all the necessary fields to the desired values -- presuming you are using FileMaker 10 or 11.

          • 2. Re: OnRecordLeave / Exit

            I thought of that, but the problem is that I don't want to change the values while people are using the record. I want to change them once they have finished with it.

            • 3. Re: OnRecordLeave / Exit

              Hi Matt


              There are two scenarios, I think, where you need to clear the fields.  One is if the user goes to another record in the same layout.  The other is when the user leaves the layout.


              So maybe you can clear the fields using the script triggers OnRecordLoad and OnLayoutExit?  When the user enters the first record, set a global variable for the record - record number or key field would probably both work.  Then the first step of the OnRecordLoad script checks for the record number they just left - clears the field and resets the record number to the new record...  A bit kludgy but it would work if you have to have it..  You could also create a session table for the user with global fields for the previous and current records.  Relate the current and previous records with the global and you can reset the previous record fields without leaving the current record.


              What about if the user changes modes?  If they perform a Find, should the fields be cleared? 


              Hope that helps with some ideas.