New version with minor bugfixes:
Improve stability to prevent the "Invalid call of the '*' client action of the '*' since the latter is not currently active. This is likely due to a platform's client action being used as an event handler or in a setTimeout function. Consider removing this call by using the 'On Destroy' event of the screen/block or moving your logic to a global client action." message in Service Center logs.