1 2 Previous Next 20 Replies Latest reply on Mar 6, 2017 11:59 AM by Claw'd

    GoToObject not honoured


      When the next to last step in a script is "GoToObject(ObjectName)" and the last step is "ExitScript" the object is not selected. If "HaltScript" is used it is selected. Anyone noticed this?

        • 1. Re: GoToObject not honoured

          Depending on the script details, you may not need the Exit Script step. Or, you can try putting a time delay prior to the Exit script step (Pause 0.2 or 0.5 seconds for example) so that it goes to the object first. Sometimes scripts (also true in JavaScript and others at times) need a little timing help.


          But I'd also check the need for the exit step.

          • 2. Re: GoToObject not honoured

            "Halt script" stops all script, then the last step is the last.

            "Exit script" exits current script, so further scripts could run from script stack. So would go to another object etc.

            • 3. Re: GoToObject not honoured

              Was this a script performed by a script trigger?


              If so use Exit Script [false]


              this cancels the "triggering event" in script triggers that are performed before that event is processed. If this is a trigger like OnObjectExit, the tab that trips the trigger causes the script to put the focus as specified by go to object, but then the tab is processed and the focus moves to the next object in the layouts tab order--unless Exit Script [false] cancels it.

              • 4. Re: GoToObject not honoured

                Sorry didn't include this: Using FM 14 these exit script steps worked. Upon moving to FM 15 they didn't and had to be changed to halt so I was wondering what had changed

                • 5. Re: GoToObject not honoured

                  Thanks for all the comments.


                  Let's say there are calling scripts, so a stack is built with each script exiting at a certain point and as the scripts are re-used they can't have a halt otherwise all scripts are stopped. So while being modular and having code re-use the exit script could pass true back to the calling script which then exits relying on the previous steps "GoToObject" to place the cursor in the required field. As said this all worked fine in 14 but not 15

                  • 6. Re: GoToObject not honoured

                    Which trigger?

                    • 7. Re: GoToObject not honoured

                      triggered on data saved in the last entry field. There are two. One checks the product barcode is correct, the second and last checks the location is valid. Does stuff like booking in or booking out or adding to packing record or creating picking list. Each script in turn hands back until in calling script which could be any one of several referencing different layouts and different fields. The bottom line is that the first calling script needs to know if the request is good so halting the previous script doesn't help. Anyway I have re-written everything to cope with the changes in 15 but wondered what they were and why.

                      • 8. Re: GoToObject not honoured



                        The calling script relies on Exit Script  or in this case Exit Script , so Exit Script  gives the wrong info. As I see it the Exit Script [] allows any value to be returned to the calling script. Having to set it to “False” somehow defeats the object as the FileMaker definition of this is  "Exit Script [Result:




                        This message (including any attachments) is intended only for the use of the individual or entity to which it is addressed and may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (+44 1473 410819)and (1) destroy this message if a facsimile or (2) delete this message immediately if this is an electronic communication. Thank you.

                        • 9. Re: GoToObject not honoured

                          Exit Script [False]


                          As documented in FileMaker Help, (See "setting up script triggers") works the same in 14 and15. It will keep the triggering event from being processed for "before the event" triggers. Just tested this in FileMaker 15  on a windows platform to confirm and it works the same for me as previous versions.

                          • 10. Re: GoToObject not honoured

                            I don’t want to exit with a “False” so this is a non starter as explained in my post. Any way it’s not a problem as have rewritten the scripts. I suggest trying to exit with any other value than “False" to test this.


                            There is also no need for the focus to change as the calling script doesn’t modify the previous scripts call to “GoToObject[]” So going to the next field doesn’t make any sense.


                            I can see where you a coming from on this but it worked fine in 14 and now doesn’t in 15. I can only imagine that as it works in 15 is correct and the moving out of the “onsave” field has been enforced.


                            I’d suggest also that limiting the "Exit Script []” to “False” is not helpful in this context.



                            Kind Regards


                            Patrick Kenlock

                            • 11. Re: GoToObject not honoured

                              There is also no need for the focus to change as the calling script doesn’t modify the previous scripts call to “GoToObject[]” So going to the next field doesn’t make any sense.

                              It's not the script, it's the user event that trips the script trigger that gets canceled by Exit Script [false]



                              You have an OnObjectExit trigger set on a field. You press the tab key to exit the field. This trips the trigger before FileMaker responds to the focus change caused by pressing tab. The script runs and uses go to object to put the focus on a layout object. But if you do not end the script with Exit Script [False], then once the script ends, FileMaker picks up where it left off, processes that keystroke and changes the focus accordingly, negating the go to object step's focus change in the script. This was one of the very first "gotchas" I had to learn about when Script Triggers became a reality in FileMaker.


                              Your description of wanting to return a script result other than False makes no sense to me. If the script was performed by a trigger, there's no-where to which to return that result. If your triggered script is performing a subscript that returns a value to the triggered script, then you are putting Exit Script [False] in the sub script when it should be put in the master script that called it.

                              • 12. Re: GoToObject not honoured

                                The script is triggered by OnObjectSave. The assumption being that as the field data is committed the cursor in the field serves no purpose and doesn’t affect the penultimate script calls while OnObjectExit does exactly as you describe.


                                OnObjectSave Triggers a script to run after object data has been validated and saved, but before field is exited  

                                Although the data has been validated and saved and the field not exited, in 14 it didn’t make any difference to the gotoObject called from the immediately preceding script.


                                OnObjectExit Triggers a script to run before an active object is exited

                                In this case I agree with your observations because the object (field) is still active and hasn’t been saved and validated which is why I used OnObjectSaved. It allowed the use of returned values other than “False"


                                I wasn’t using OnObjectExit for that very reason as I found that OnObjectSave worked perfectly.


                                IT DOESN’T IN FM 15 So there has been a change. It’s a bit like using a double click on a Label in layout mode to resize it used to work but has been changed. (for some time I might add)


                                What this means is that one is limited to using only the “False” tag where before 15, ExitScrip[] could be used with any useful value in a script trigger situation.



                                Kind Regards


                                Patrick Kenlock

                                • 13. Re: GoToObject not honoured

                                  Can you share this portion of your script? What "event" is tripping the trigger? A keystroke? (Characters from a bar code reader are processed as keystrokes...)


                                  Yes, OnObjectSave is an "after the event" trigger and thus Exit Script [false] cannot prevent the user event from being processed as the triggering event has already been processed. But this should also prevent it from interfering with the use of Go To Object.


                                  One thing to keep in mind is that Go To Object can also trip a script trigger. Any chance that this is the case here?

                                  • 14. Re: GoToObject not honoured

                                    I think the simple question is: the calling script did not require ExitScript[false] or Halt in 14 but does in 15 to honour the GoToObject[] in the previous script. Why?


                                    I'm sure best practice is as you describe but actual use and experience show an inconsistency in the way these script steps are handled between FM 14 and FM 15.



                                    Quite a simple question.

                                    1 2 Previous Next