Issue
-
We have implemented a single approver workflow for content review.
The requirement is to bypass this workflow for users with the Admin role, allowing them to directly create new content and publish it without going through the workflow process.
For users without the Admin role, the content should follow the regular workflow approval process.
How should this be approached?
Environment
- DXP
Resolution
- This is possible to do by writing your workflow definition accordingly. For example with a logic like this: if the submitter user has role Administrator then bypass the usual workflow stages (bypass the manual approval task, etc.). You could use a Condition node for this, so that your workflow executes a different branch if the submitter user is an admin. So the idea here is that you don't "deactivate" the workflow per se. The workflow will still be triggered, but you write it in such a way that it does nothing (it goes directly to the Approved status node) in case the modification was submitted by and admin user.
-
You can add "auto approve" logic to your script (e.g. you could probably encapsulate into a java class and then invoke from the script to keep it simpler.)
The conditional workflow script in the docs shows how to check for a tag before sending either to legal or send on its normal course. You would just be checking for "was last modified by an admin" and, if so, just send it straight to the approved state.
This would make it a) automatic and b) solve their issue w/o changing Liferay at all.
- Please find attached a very simple and abstract example of such a workflow with a very simple Condition script added and a short demo video of how it works.