Issue
- After upgrading from Liferay Portal 6.X to Liferay DXP 7.1+, we are no longer able to reject items in workflow using the default Single Approver workflow
- Items can still be approved, but if we attempt to reject it we see this error in the logs:
ERROR [liferay/kaleo_graph_walker-2][KaleoActionExecutorImpl:69] com.liferay.portal.workflow.kaleo.runtime.action.executor.ActionExecutorException: com.liferay.portal.kernel.scripting.UnsupportedLanguageException: javascript
com.liferay.portal.workflow.kaleo.runtime.action.executor.ActionExecutorException: com.liferay.portal.kernel.scripting.UnsupportedLanguageException: javascript
Environment
- Liferay DXP 7.1+ that was upgraded from Liferay Portal 6.2 previously
Resolution
- The Default Single Approver workflow in Liferay Portal 6.2 uses Javascript to set the Rejected status (line 53):
<script-language>javascript</script-language>
The Javascript scripting module is deprecated in Liferay DXP:
- The language for the default Single Approver workflow must be updated to Groovy, as this is the only supported scripting language for Liferay DXP.
- To resolve this for all new items in the workflow, you can replace the Single Approver workflow's Source with the attached XML.
- To resolve this for existing workflow items, you must update the items in the database so that the script language is changed to Groovy and the items are then rejected once again in the workflow.
- Updating existing items can be done with a Groovy script in Liferay's scripting console. It should invoke an ActionableDynamicQuery to both find and then update the applicable items. See the attached .groovy file.
Additional Information
- This script update is not handled by the upgrade process because Administrators are free to modify the Single Approver workflow and changing it during the upgrade would impact users who have done so (See LPS-82595)
- If your environment was originally running Liferay Portal 6.1 or lower, you may need to account for two additional changes:
- The Approve action may need to be updated to Groovy as well (this would be handled by using the attached .XML).
- The Site Content Reviewer role in the attached XML may need to be changed to Community Content Reviewer because the role for workflow in 6.1 was called Community Content Reviewer.