5 Replies Latest reply on Jan 19, 2012 3:27 PM by philmodjunk

    Help with Dialog button not working



      Help with Dialog button not working


      I am have a problem getting the trigger scrtipt to work. A Dialog box opens and ask if you want to correct the error. If I press OK (Button 1) it is suppose to take me back to the LABORLOG layout. but its is not working. Here is my script:


      Can anyone see what I did wrong?



        • 1. Re: Help with Dialog button not working

          You need to add another few steps.  You must capture the option the user clicked on.  So it would look like this:


          If ( Get ( FoundCount ) = 0 )


          Show Custom Dialogue ( "Alert" ; "Do you want to go HERE or THERE?" )

          If ( Get ( LastMessageChoice ) = 1 )

          Go to Layout 'HERE'


          Go to Layout 'THERE'

          End if


          End if

          • 2. Re: Help with Dialog button not working

            Given that the OP DOES use Get ( LastMessageChoice ) = 1, some other factor is interfering that we can't see from what is posted so far.

            Either the desired layout is not the "original layout" or a script trigger on the layout (on layout enter or On Record Load) is interfering with your results are two possibilities that I can imagine.

            If you have advanced, you might want to run this script with the debugger enabled as that makes it easier to see what might be going wrong with your script.

            • 3. Re: Help with Dialog button not working

              I was, eh... reading some other post entirely at the time.


              • 4. Re: Help with Dialog button not working


                There are trigger scripts on entering that layout and trigger scrips on entering the other layouts. That seemed to be the issue. I adjusted the script by adding HALT SCRIPT. Do you see and disadvantage to using this command?


                • 5. Re: Help with Dialog button not working

                  Does that work for you?

                  You took out a go to layout step and that's what is keeping the trigger from being tripped. If that does the job great, but you can probably remove the halt script step.

                  The Halt Script won't do anything in this context unless there is another script on the call stack (a script was paused before this one was executed or another script used Perform script to perform this script...) In those cases, it will terminate those scripts as well as the above script. (Which was going to terminate anyway.)

                  There are two ways I use to keep layout based triggers from being tripped in scripts like these.

                  1) Make a duplicate layout and remove all triggers from the duplicate layout. Specify this layout in Go to Layout. This method is useful when your script goes to a layout, does some stuff and then switches back. It's not a good option when you need your script to go to a layout and stay there for the user to interact with.

                  2) Put the trigger controlled script inside an If block that tests a global variable:

                  If [Not $$TriggersOff]

                    #Put script steps here

                  End IF

                  Then use these steps in scripts that would otherwise trip the script trigger:

                  Set variable [$$TriggersOff ; value: True ]
                  Go To Layout [....
                  Set variable [$$TriggersOff; value: false ]

                  That method temporarily disables the triggered scripts.