Switch expects one or both of the following two entry points to be present in each script:
This entry point is invoked each time a new job arrives in one of the input folders for the script element. The newly arrived job is passed to the entry point as the second argument.
This entry point is invoked for the first time immediately after the flow is activated and thereafter it is invoked at regular intervals regardless of whether a new job arrived or not. The default value for the interval is 300 seconds (5 minutes); it can be modified with Switch.setTimerInterval().