6 Replies Latest reply on Oct 17, 2016 9:54 AM by briancrockett

    Trigger Preventing Auto-Enter From Firing

    briancrockett

      I have a field (Radio Buttons) that is referenced in the auto-enter formula in another field in the same table. When the first field is modified the second field recalculates as it's supposed to.

       

      I've added an "OnObjectModify" trigger to the first field that calls a script to commit the record so other users can see the change immediately.

       

      The problem is, now the auto-enter field is not updating. If I turn off the trigger it starts to update again.

       

      I've tried:

      1. Putting a 1 sec pause before the "commit" so there's time to update.
      2. Adding an "Exit Script" True
      3. Changed it from an "OnObjectModify" to "OnObjectSave"

       

      The first two didn't do anything but changing to "OnObjectSave" did. It works with "OnObjectSave" but not "OnObjectModify".

       

      This is kind of a weird, unexpected quirk, that makes me worry about the integrity of my data. How many other "Auto-Enter" fields do I have that are not updating properly?

       

      Is there a reason why a specific type of trigger prevents an auto-enter from firing?

        • 1. Re: Trigger Preventing Auto-Enter From Firing
          Johan Hedman

          Why dont you set the data instead of using a Auto-Enter if you still use a script to commit your data?

          • 2. Re: Trigger Preventing Auto-Enter From Firing
            BillisSaved

            Good morning briancrockett,

             

            I hope your day is going well. I'm curious, if you implement your initial configuration (i.e. use the OnObjectModify trigger) and make the change to the radio button selection then refresh your window manually, do you see the expected results? Have a great day!

             

            God bless,

             

             

            Bill

            • 3. Re: Trigger Preventing Auto-Enter From Firing
              briancrockett

              The Auto-Enter, in this case, is for log keeping. There's like 40 different fields referenced in the formula.  When any of those fields change it updates a Log field with date, time, account, field, and data that was changed. I'm using Ray Cologon's very handy SuperLog custom function.

               

              I guess I could update the log with the trigger but it kind of goes against the purpose of using the Custom Function.

              • 4. Re: Trigger Preventing Auto-Enter From Firing
                briancrockett

                No, it doesn't work.

                • 5. Re: Trigger Preventing Auto-Enter From Firing
                  philmodjunk

                  I suggest providing a bit more detail on that auto-enter calculation. And does that script do anything more than just commit records?

                   

                  I just ran a quick test with a text field formatted with radio buttons and a "log" field with this auto-enter calculation:

                   

                  Let ( Trigger = RadioButtonfield ; Get ( CurrentTimeStamp ) )

                   

                  An OnObjectModify trigger on the radio button field that had a single commit records script step did not keep the Log field from updating with a different time stamp each time that I clicked a  radio button.

                  • 6. Re: Trigger Preventing Auto-Enter From Firing
                    briancrockett

                    Looking at the Custom Function used in the auto-enter field. I see it sets a variable (Scpt) in a Let statement that is equal to Get(ScriptName) .  The value part of the Let function contains an IF Length(Scpt) = 0.

                     

                    So if a script is running when the CF is evaluating it doesn't update the field due to the IF. OnObjectSave must trigger the script after the auto-enter has run, so they don't interfere, and the OnObjectModify is running the script and auto-enter at the same time.

                     

                    Didn't expect a custom function to be looking to see if a script is running. I suppose it's so that the log doesn't update when a field is updated from a script. There is another CF as part of the same set that is used to update the log from a script. I guess this is meant for the developer to have greater control over when the log get's updated.

                     

                    Thanks for your replies. Question Answered