fixes #4329 Script errors on Workflow Tasks search

Fixed the issue and committed the code for review, please check it.