Reusable or Dynamic Select Options in Custom Fragment Configuration

What is the problem you are trying to solve?

When creating a Custom Fragment in Liferay, it is possible to define a Select field in the JSON configuration (see: https://learn.liferay.com/w/dxp/development/developing-page-fragments/reference/fragment-configuration-types-reference#select-configuration).

Currently, the options for the Select field must be defined manually, for example:

"typeOptions": {
  "validValues": [
    { "value": "1" },
    { "value": "2" },
    { "value": "3" }
  ]
}

The issue is that when the same Select field is used across multiple Custom Fragments, this configuration has to be duplicated in each fragment. As a result, any change (adding, removing, or updating an option) requires updating all fragments individually.

It would be nice to have a way to:

  • Dynamically populate the Select options (e.g., from a centralized source), or

  • Define the Select configuration once in a single location and reuse it across multiple fragment configurations.

What is your project about? (e. g. Intranet, Partner Portal, Enterprise Website, etc)

Enterprise Website

What is your proposed solution? (optional)

…

Thanks for your feedback, did you try to leverage picklists for this as well?

Hi Luiz,

I thought picklists were primarily meant for Custom Objects.
As things stand, I don’t see how I could use picklists in the configuration (JSON) part of a custom fragment.

Could you clarify what you had in mind?