Actions

Understanding Action Types

Liferay 7.4 U60+/GA60+

Actions define custom operations triggered by object entry events. Liferay provides these action types:

TypeDescription
NotificationSend email or user notifications using a predefined template.
Add an Object EntryCreate entries in an active object.
Update an Object EntryUpdate fields in the current object entry.
WebhookDeliver a payload to a URL.
Groovy ScriptExecute Groovy scripts.
Important
  • Groovy script actions are only available for Liferay PaaS and Liferay DXP Self-Hosted.
  • As of DXP 2024.Q2/Portal GA120, scripting is disabled by default. You can enable it in System Settings → Script Management (under the Security category).
  • Create custom object actions with object action client extensions.

Notification

Use a notification action to send user or email notifications for object entries. Example use cases include

  • Automatically sending email notifications for new orders
  • Automatically sending user notifications for ticket updates within a custom ticketing system
  • Manually sending email notifications to remind users of tasks and events

You must select a notification template to determine the sender, recipient, and content for each message. For email notifications, your instance also requires a configured mail server.

Select a notification template.

If the out-of-the-box notification types don’t meet your needs, you can create custom notification types using client extensions. See Microservice Client Extensions for more information.

Add an Object Entry

Create an entry in a specified object. Example use cases include

  • Automatically adding entries in a custom Shipments object when orders are paid
  • Automatically adding a default user for new accounts
  • Manually adding a child ticket to the current ticket within a custom ticketing system

You must select an active object. You can then set predefined values for the entry’s fields. Enter these values directly or click Code ( Code ) to use expressions that set values dynamically. If the object includes required fields, you must set predefined values for them.

Select an active object and enter predefined values for the created entries.

Update an Object Entry

Update one or more fields in the current object entry. Example use cases include

  • Automatically updating an entry’s boolean field to true after users download its attached file
  • Manually updating a ticket’s assignee to the current user when clicking a button
  • Automatically updating an entry’s boolean field to true after users favorite it

You must select the field(s) to update in the current entry and enter new values. You can enter these values directly or click Code ( Code ) to use expressions that set values dynamically.

Select the fields from the current object entry that you want to edit and enter default values.

Webhook

Webhook actions deliver a data payload to a target URL when an object event occurs. This enables Liferay to push real-time data to external systems.

URL: Enter a target endpoint in the URL field. This is the destination where the external system listens for incoming POST requests from Liferay.

Secret: An optional shared string used to verify the payload’s integrity. By configuring the same secret in Liferay and the receiving system, the external service can verify that the request is authentic and originated from a trusted source.

Warning

If your target endpoint requires OAuth 2.0, you must use a object action client extension instead.

Enter a webhook URL and secret.

You can use webhook actions to integrate Liferay with various third-party automation tools and platforms. See Using Google Sheets with Objects for step-by-step tutorials.

Groovy Script

Important

As of DXP 2024.Q2/Portal GA120, scripting is disabled by default. You can enable it in System Settings → Script Management (under the Security category).

Groovy Script actions execute Groovy scripts. Enter your script into the provided code window. For Liferay 7.4 U33+/GA33+, Liferay uses the GroovyShell class to validate Groovy script syntax when you click Save. If the script is invalid, Liferay displays a general error message.

Enter your Groovy script.

While Groovy scripts are available for some environments, object action client extensions are the recommended alternative for implementing custom logic. Client Extensions provide a more scalable approach and support modern security standards like OAuth 2.0. See Object Action Client Extensions for more information.