Sitecore Content Hub - nested search component for users in a usergroup
We have a custom entity called Document in our ContentHub setup. Which has a relation to User, the field is called UserToDocument internally and its displayname is "Owner".
We want editors - who are the creators of a Document - to be able to select an Owner. And this isn't always the editor itself. So hence the relation to User and the need for some additional configuration.
Requirement: When we create a Document, the editor needs to select a user from a list. We only want users that are in a specific Usergroup. And - if needed - can be easily removed from the list as well.
In the end, this can contain a list of users which indicate that they are "responsible" for it. And it will allow other users to see who is responsible for it as well.
You start by adding a Search component to your page and then add a Filter to it:
- User
- and a Relation to UserGroup
The screenshot below shows that the UserGroupToUser field should equal 'M.Builtin.Content.Administrators' which I took as an example here.
In the functionality tab of your search component, make sure that you have selected Use in relation editor. Since otherwise you will not be able to select this search as your filter when creating or editing objects (Documents in my case).
The search component should be Nested and not visible:
You can configure nested on the settings of the Search component.
In your details component, select the cog on the field that you want to hook up to this search component and select your nested search in the Functionality tab
This results in a custom search where all the users are listed that we want:
Additional note:
- it is not possible to style the output of this list
- you can add additional facets to aid the users to find an owner more quickly