6 Replies Latest reply on Mar 26, 2010 12:52 PM by johnhorner

    layout specific actions for custom menus

    johnhorner

      Title

      layout specific actions for custom menus

      Post

      i am hoping that there is a way to assign a script to the "new record" command that will run a different script depending on what layout the command is launched from (i.e in "contacts" i would like to run my "new contact" script, and for "invoices" i would like to run my "new invoice" script).  however, i could only see a way to attach a single script to a custom menu.  am i missing something or is this not possible?  do i need to make multiple custom menus or menu sets that somehow are linked to the layouts?

       

      i am completely new to working with custom menus so please pardon my ignorance.

        • 1. Re: layout specific actions for custom menus
          philmodjunk

          Set your script up with If steps that branch to different actions based on which layout is current.

           

          If [ get ( LayoutName ) = "Data Entry" ]

          #do the data entry version of new record here

           

          Else If [get ( LayoutName ) = "Report" ]

          #Do the Report version of new record here

           

          and so on for each layout.

          Be aware that if you use this get function, renaming your layout also require updating your script.

           

          You can also use Get ( LayoutNumber ) to identify the current layout.

          • 2. Re: layout specific actions for custom menus
            johnhorner

            thanks phil!

             

            if i were to use get(layoutnumber) instead of get(layoutname), does that layout number stay with the layout for life like a serial number, or does it change depending on it's order in the "manage layouts list", for example, or some other dynamic attribute?

             

            also, i noticed that there was a way in the layout setup to choose a cusotm menu set.  are there easily defineable situations when you would use a different menu set applied to a layout vs. the method you outlined where the script would handle the selection of the appropriate action depending on the context?

             

            finally, if you don't mind my asking one more custom menu question... is there an easy way to make a copy of the default set... for some reason the "duplicate" option is not available for this set??  thanks again.

            • 3. Re: layout specific actions for custom menus
              philmodjunk

              if i were to use get(layoutnumber) instead of get(layoutname), does that layout number stay with the layout for life like a serial number, or does it change depending on it's order in the "manage layouts list", for example, or some other dynamic attribute?

               

              It changes depending on the order.

               

              also, i noticed that there was a way in the layout setup to choose a cusotm menu set.  are there easily defineable situations when you would use a different menu set applied to a layout vs. the method you outlined where the script would handle the selection of the appropriate action depending on the context?

               

              Actually, my script could be a script selected from a custom menu. I use custom menus to add additional menus or to change the behavior of a standard menu option if the needs of my project make this a good idea.

               

              finally, if you don't mind my asking one more custom menu question... is there an easy way to make a copy of the default set... for some reason the "duplicate" option is not available for this set?? 

               

              Custom Menu Set 1 is a copy of the default set. You can make duplicates of this set as needed.

              • 4. Re: layout specific actions for custom menus
                johnhorner

                thanks phil... now i get it (i think?)!  i am a little slow on these new concepts.  but if i understand it now, i could make a single custom menu with a solution-wide "new record" script that would then use your method of get ( layoutname ) to launch the layout specific new record subscript?  awesome!

                 

                one small problem... i seem to have deleted my custom menu set 1... is there a way to reload it or grab it from a different file or something?

                 

                ooops!

                • 5. Re: layout specific actions for custom menus
                  philmodjunk

                  Not as far as I know...

                   

                  Deleting a menu set does not delete it's custom menus.

                  Simply create a new custom menu set and add the desired menus (you'll find menus like Edit Copy that you can add to your new set.)

                  • 6. Re: layout specific actions for custom menus
                    johnhorner

                    oh well... thanks again for all the help!