AnsweredAssumed Answered

Exiting a script within a script

Question asked by captainamerica24 on Feb 7, 2017
Latest reply on Feb 7, 2017 by siplus

If I have a script running, and it calls a sub-script, is there a way to exit the entire script from the sub-script. For example, Script1 calls for the script step Perform Script, which performs Script2. Script2 has an option that I want to be able to cancel the entire script (Script2 and Script1). So far, it seems it only cancels Script2, but then returns to where it left off in Script1. I have tried using the Exit Script but it only exits the sub-script if performed within the sub-script. For Example:

 

Script1

1. Set Field [ Customer::Name ; John Doe ]

2. Perform Script [ Script2 ]

1. Show Custom Dialog [ "Exit Script" ;

"Would you like to exit the script?" ]

2. If [ Get ( LastMessageChoice ) = "Yes" ]

     Exit Script [ Test Result : ]

3. End If

3. Set Field [ Customer::Name ; Jane Doe ]

 

I would like it to perform steps 1 and 2 in Script1, but if the user selects "Yes" in the custom dialog, it will exit everything rather than just the sub-script, which is Script2. Does this make sense?

Outcomes