Feedback on Overriding JS in Liferay 7.4 Workflow Task Portlet

Hi,

I’m looking for some feedback on the best approach to override the core JavaScript in Liferay 7.4, specifically the script in the Workflow Task portlet that handles redirects when approving or rejecting tasks.

The JavaScript is part of the workflow-task-web module, in particular workflow_task_action.jsp , specifically the function used as a propTransformer in the Clay Dropdown component. This function currently handles redirects when approving or rejecting tasks.
Any guidance, examples, or best practices would be greatly appreciated.

Thank you,
A.

Hello @alessandro.barboni,

It is not recommended to override core Liferay JS files through custom modules or via fragments, as it can lead to unknown and unexpected consequences at runtime. However, you can override this using Liferay’s default AUI and YUI modules.

Liferay DXP contains several default YUI/AUI modules. You may need to override functionality provided by these module’s scripts. To do this, you must create a custom AUI module containing three things:

• A copy of the original module’s JavaScript file containing your modifications

• A config.js file that specifies the modified JavaScript file’s path and the module it overrides

• A bnd.bnd file that tells the OSGi container to override the original

For more information on this, please refer to our legacy documentation: Legacy Documentation - Liferay Official Documentation - Liferay Learn → Developing Liferay DXP 7.1 → Chapter 56 (56.5)

I have used this approach before with Liferay 7.1.
Is it possible to apply the same approach in Liferay 7.4 when dealing with a JavaScript file that does not rely on AUI, but uses plain JavaScript and references Liferay’s native JS package (frontend-js-web)?

Thank you