Managing Object Entries with Data Sets

Data sets offer a flexible way to display object entries. When your advanced use case outgrows collections, data sets fill the gap. For example, Collections can display only object entries with the status approved, so building an application for managing draft object entries requires using data sets.

This example Blog definition uses data sets to manage draft entries from a Liferay page:

  1. Create and publish an object definition with draft entries enabled. Give the object definition at least one custom field.

    Configure these object details:

    • Scope: Company
    • Panel Link: Object
    • Allow Users to Save Entries as Draft: [Enabled]

    Add these fields:

    • Title: Text field
    • Content: Rich Text Field
  2. Create a display page template for adding new entries. For this example use Create Blog. Add a form container configured for the object. Edit the button’s Submitted Entry Status to save entries as drafts. Rename the button to Save to reflect its purpose.

    Add another button to publish entries with the approved status. Call it Publish.

    The form container on the object creation display page has a button for saving draft entries.

  3. Create a second display page template for editing object entries and place a form container on it. For this example, use Edit Blog.

    Configure Save and Publish buttons as above.

    After publishing the display page, mark it as the default display page for the object. Now, accessing an existing object entry at its friendly URL opens the edit page.

    There are two display pages: one for editing entries, and one for creating new entries.

  4. Next, add a data set. You must enable these release feature flags:

    • Root Object Definitions (LPD-34594)
    • Data Set Manager (LPS-164563)
  5. Create a data set in Control Panel → Object → Data Sets. To show the custom object entries, use the appropriate GET endpoint.

    Create a data set for the blogs object entries.

  6. Create a table visualization mode to show the entries. Include any custom fields you want, plus the status label.

    You can edit the labels and change the renderers to improve the presentation of the table.

    This example shows the field’s title, creator name, status, and content.

  7. Create two data set actions:

    1. Add a New Creation Action for adding entries. Make it a link to the Display Page Template (DPT) for adding entries. You can get the friendly URL for a display page by accessing its configuration. In the example here it was /create-blog, since the page was named Create Blog.

    2. Add an Edit Item Action for editing entries. Make it a link to the DPT for adding entries. The edit link for an entry is the link to its friendly URL:

      • If your object definition does not show the friendly URL configuration in its Details section, the friendly URL pattern is /l/{id}
      • If you have Liferay DXP 2025.Q3+ with the feature flag Friendly URLs for Object Entries (LPD-21926), the pattern is /separator/{id} (e.g., /c_blog/{id}.
  8. Place the data set onto a page and select the view you created. Once you publish the page, add some entries as drafts; then edit them and publish them.

    You can list draft and approved entries in data sets.

Warning

Draft entries can be saved as draft or published as approved. However, approved entries cannot be reverted to draft status. In this example, your Publish button always works, but your Save button for draft status entries fails if used with an approved entry.

If you’re not displaying draft object entries, it’s easier to use the object’s collection provider in a collection display fragment. If you must show draft entries, however, you can use data sets.