Is it possible to filter the Account Selector search results to exclude fields?

Issue

  • I would like to add a filter to the Account Selector fragment so that it excludes selected matching fields from the search results.
  • For example, I would like to exclude any results with Account IDs that match the numbers that I'm searching, so that I only get Account Names that include the number strings.

Environment

  •  Commerce

Resolution

  • Unfortunately, it's not possible to filter Account Selector results at this time.

Additional Information

  • We have an open feature request at LPD-33145 to explore the option of adding filters to the Account Selector fragment.

NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.

  • In the meantime, it may be possible to customize the account selector by overriding

    the AccountResourceImpl class with another component that, in the pre-filter of the getChannelAccountsPage method, add another filter to booleanQuery like this:

if (Validator.isNotNull(search)) {
PrefixFilter prefixFilter = new PrefixFilter("accountEntryId", search);

    booleanQuery.getPreBooleanFilter().add(prefixFilter, BooleanClauseOccur.MUST_NOT);
}
  • In this way, the accounts that have the id equal to the search term will be filtered out.
この記事は役に立ちましたか?
0人中0人がこの記事が役に立ったと言っています