oo

Using the Script Engine

Liferay provides a robust script engine for executing Groovy scripts. You can execute scripts to perform maintenance tasks involving data cleanup, user maintenance operations, bulk Liferay API invocations, or even system level operations.

In self-hosted or PaaS instances, you can also leverage scripts in multiple applications:

The Script Console executes Groovy scripts and provides context variables, such as the current actionRequest. The Script Console was designed for invoking Liferay Services.

Enabling Scripting

Beginning in DXP 2024.Q2/Portal 7.4 GA120, scripting is disabled by default in workflow and objects (validations and actions). Administrators won’t even see the option for creating or executing scripts in these applications unless permission is granted explicitly by a system-level administrator.

To enable scripting for administrative users of workflow and objects,

  1. Open the Global Menu (Global Menu) and navigate to Control PanelSystem Settings (in the Configuration section).

  2. From the Security category click Script Management.

  3. Check the box to enable scripting.

  4. Click Save.

Once enabled, the option appears for administrative applications that can leverage scripting:

You can enable scripting in supported applications.

The Script Console is available in the Control Panel. To use it, follow these steps:

  1. Log in as an administrator.

  2. Open the Product Menu and navigate to the Control Panel and select ConfigurationServer AdministrationScript.

    The Script Console is a tab within the System Administration menu.