2 Replies Latest reply on Feb 3, 2016 12:50 AM by BKamp

    different script steps based on button


      Hi guys!


      Right now I have four buttons with accompanied scripts:

      1. print invoice
      2. print invoice + tracked hours
      3. email invoice
      4. email invoice + tracked hours


      I could combine it in one script, which saves me a lot of double steps etc, if I knew how to let a script take different steps based on what button is clicked.

      how can I do this?


      Im trying stuff with a global variable `$$` in another script as well, but the global variable does not seem to work outside of the script is was defined, how are they supposed to work? do you need to define them in a standalone script or something?



        • 1. Re: different script steps based on button

          When you set up the button to launch a script, you have the option of putting in a "ScriptParameter"


          Button 1 would have the Parameter "PI"

          Button 2 would have "PITH"  (heehee)

          Button 3, "EI"


          Then you can branch your script based on Get(ScriptParameter).

          If ( Get(ScriptParameter) = "EI" ) and so forth...


          If you always do the same one for a given record, you could also make a field on your record for what to do with that customer and branch the script based on that field...that way you would only need a single button at all....

          • 2. Re: different script steps based on button

            Thanks Eric!


            didn't knew that was possible! great to know!