5 Replies Latest reply on Aug 29, 2016 6:29 AM by FileKraft

    OnObjectSave trigger not firing for external tables

    gobbles

      Hello,

      I am working with Filemaker 11.

       

      I have a script set to fire in a portal 'OnObjectSave'. The script inserts some text into a field in the current table depending on the value just inserted in the related table.

       

      I need to present the database in a separate filemaker database (I have to include tables from three separate databases in a single UI)

       

      The script and trigger work fine when used inside the actual database, however it is not firing at all when I try to call it from the host database.

       

      The host database is able to modify and add content to both the portal and fields in the main database.

       

      It does not seem to matter whether I call the script from the external source or recreate it in the host database.

       

      Is there some issue with 'OnObjectSave' not firing if the table being saved to is external? And if that is the case is there some other way to start the script?

        • 1. Re: OnObjectSave trigger not firing for external tables
          philmodjunk

          Am I correct that you are using a script to trip the script trigger? Exactly what script steps are you using to do that? (Some steps do not interact with layout objects and thus modify data without tripping triggers. Others do.)

           

          And if that's what you are doing, it might be simpler just to call the script you are trying to perform via script trigger directly.

          • 2. Re: OnObjectSave trigger not firing for external tables
            gobbles

            No exactly.

             

            I am triggering the script to insert text via the portal's own built in script triggers.

             

            Once called the script:

            1. gets the last value entered in the portal (rather clumsily by getting the previous active portal row and then the related field value )

            2. calculates the insert text by looking up some global fields (So my users can edit them) that correspond to the related field's value and appending it to the target field

             

            This works fine inside the actual DB but the trigger simply is not firing the script in the host DB.

             

            Additionally, some further testing I discovered the 'onObjectExit' trigger will fire the script happily but as I rely on getting the active row for my script this breaks and cycles through all rows. Flooding my target field with all values.

             

            If there is a better way to do what I want I would love to hear it.

             

            I just want to grab the last entered value in the portal and use it to look up a corresponding global value which is then inserted into a target field.

            • 3. Re: OnObjectSave trigger not firing for external tables
              gobbles

              Well I was able to get the trigger firing by placing it on the actual field inside of the portal and varying my script accordingly.

               

              Attempting to set a trigger on the portal however does no fire OnObjectSave for an external table as far as I can tell. Is this behavior intended?

              • 4. Re: OnObjectSave trigger not firing for external tables
                Mike_Mitchell

                gobbles wrote:


                Attempting to set a trigger on the portal however does no fire OnObjectSave for an external table as far as I can tell. Is this behavior intended?

                 

                Yes. A portal does not have a "save" event. Fields do, but not portals.

                • 5. Re: OnObjectSave trigger not firing for external tables
                  FileKraft

                  the OnObjectSave trigger does only fire on attached fields.