Is there an alternative to the 'Liferay.Util.selectEntity' function?
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
Issue
- After upgrading to 2024.Q2+,
Liferay.Util.selectEntity does not work anymore. It has been removed, according to the 2024.Q2 Breaking Changes.
- Is there any replacement for it?
Resolution
- Although it has been removed as of 2024.Q2, the replacement was made a few years ago in LPS-112298 Update Liferay.Util.selectEntity utility, as part of the epic LPS-101984 Provide Modal Patterns matching Lexicon Definition, where you can find more information.
- Within the product, usages of
Liferay.Util.selectEntity (AUI-based) were replaced by Liferay.Util.openModal (Clay-based). You can find the changes in this pull request. For example (FragmentCompositionDropdownDefaultEventHandler.es.js):
- Before
Liferay.Util.selectEntity(
{
dialog: {
constrain: true,
destroyOnHide: true,
modal: true,
},
eventName: this.ns('selectFragmentCollection'),
id: this.ns('selectFragmentCollection'),
title: Liferay.Language.get('select-collection'),
uri: selectFragmentCollectionURL,
},
(selectedItem) => {
if (selectedItem) {
...
}
}
);
- After
Liferay.Util.openModal({
id: this.ns('selectFragmentCollection'),
onSelect: (selectedItem) => {
if (selectedItem) {
...
}
},
selectEventName: this.ns('selectFragmentCollection'),
title: Liferay.Language.get('select-collection'),
url: selectFragmentCollectionURL,
});
did-this-article-resolve-your-issue