5 Replies Latest reply on Feb 8, 2010 8:21 PM by Keystone

    Simple Navigation Button Script



      Simple Navigation Button Script




      I have a resume (CV) database that contains two Layouts, one for Engineering and one for IT (different divisions of the company). I have a button on both of these Layouts that says "Enter New Candidate"


      Keeping in mind that I'm new to scripts, I'd like these buttons (when clicked) to display a custom dialog that asks if the user is sure if they're entering the candidate in the correct Layout.


      For example, If the user is in the Engineering Layout, and the click on "Enter New Candidate", the dialogue would ask:


      "Are you sure this candidate belongs in the Engineering Database?"


      The options would be: "Yes, continue" or "No, go to IT"


      Obviously if the answer is "Yes, continue", FM opens a new blank record in "Engineering" to be entered.

      If the answer is "No, go to IT", FM opens up a new blank record in the IT Layout.


      Again, being new to scripts I'd appreciate it anyone could offer a simple solution to this problem.


      Thanks in advance!


        • 1. Re: Simple Navigation Button Script

          You're in luck. FM makes what you are wanting to do really easy with basic script steps.


          Use the script step "Show Custom Dialogue"  to display the dialogue, with buttons, and return the button the user clicked in.


          A simple if/else/endif will do the rest for you.



          • 2. Re: Simple Navigation Button Script

            Use an If statement saying:



            Get (LastMessageChoice) = 1  (1 is the default button, 2 is for the button next to it and 3 the next one)

            Go to layout...


            Go to layout...


            • 3. Re: Simple Navigation Button Script

              Thanks for the clarification Ken and Hildy. I apologize but I'm very new to scripts and I'm a little lost.


              I've set the script trigger to run 'OnObjectEnter', so I assume it's supposed to run when the button is clicked?


              Nothing happens however... what am I missing?


              So far I have:



              Show Custom Dialog [Message}

              If [Get (LastMessageChoice) = 1]

                 Go to Layout [original layout]


                 Go to Layout["IT Layout" (IT Layout)]

              End If



              So, the problem is that this script doesn't do anything when I click on the button (it opens a new record to enter, but no dialog box)


              I want the default button to open a "new record" in the original layout, and by pressing button 2, I'd like it to go to a NEW RECORD in the other layout (IT Layout).


              Unfortunately things need to be spelled out for me at this point...



              • 4. Re: Simple Navigation Button Script

                OnObjectEnter script triggers don't work by clicking onto something.  They work if you tab onto them.


                Just attach the script to the button itself.  You can make anything a button by clicking on it, going to Format in the menu bar (or right clicking) and selecting "Button setup".  Then just attach the script to it.


                So it sounds like you need two different buttons with two different scripts.  Unless you use one button, and then you can show the custom dialog, and the script will branch in a different direction depending on which choice the  user maker.

                • 5. Re: Simple Navigation Button Script

                  Thanks Hildy, I've assigned the script to the button and the dialog comes up... do you have a solution for the second part of my problem? I don't think I need two buttons do I?


                  I simply want to have the default button to stay on the current layout, yet open up a new record. 


                  The second button needs to go to the IT layout, AND open a new record.