Application Control
Synchronous
No Custom Parameters
Final
EndScript informs the Application Runtime Environment to destroy the script.
EndScript unloads the resources associated with the script, such as global variables. Every script should always come to an end with either EndScript or Forward; otherwise, script instances will continue to build up, which consumes memory resources on the application server.
Ensuring that all script instances come to a conclusion is important with regards to licensing; the application server licensing scheme is based on the amount of concurrently running scripts. Ending a script instance releases one script instance license unit.
When a script ends due to EndScript, the InstanceDestruction event is fired with an ErrorCode value of 0.
After a script is ended, any non-triggering (unsolicited or asynchronous) events routed to this script instance will result in a no handler. The provider that orginated the event is informed of the no handler and can take the appropriate action for the protocol or API it consumes.
If sandboxing is turned on, then any calls or connections that were created by the script instance are automatically destroyed.
EndScript is an example of a final action, which means no other actions can occur after this action in the function from which it was invoked. In the special case of EndScript or Forward, the only actions in the current script instance that can occur after their usage are those in the InstanceDestruction event handler.
The other means by which a script instance can end are by Forward, being unloaded, and by crashing (such as when an unhandled exception occurs in a CustomCode action or a native action).
No Action Parameters
No Result Data
No Defined Branch Conditions