Programmatic filter capabilities

Hello,

I want to make sure I’m not missing any functionality in using the filter component. Sometimes solutions exist outside of what is in the framework documentation, and I can also just be overlooking what I need.

In the CUBA app I’m working on, a user registers on an anonymous screen and sets their email and organization. I’ve got an Organization entity created, and don’t want to blindly add what the user has entered, in case of misspellings or trolling or whatever. So when the user confirms their email address, their User entity is created with a string representation of their organization and a placeholder role.

At this point, there is an approval process where the user is vetted and their organization is verified. What I would like to accomplish is to create a button on the UserEdit screen that will open the organization browse screen and apply a pre-created filter using the organization name and email domain to load similar records. The problem is that I can’t figure out how to get this to work as expected.

The Organization entity only stores the org name and optional email domain:

The user editor contains the screen opening:

    @Subscribe("findSimilarButton")
    public void onFindSimilarButtonClick(Button.ClickEvent event) {
        ExtUser editedEntity = (ExtUser) getEditedEntity();
        MapScreenOptions options = new MapScreenOptions(ParamsMap.of("name", editedEntity.getOrganization(),
                "emailDomain", getDomainFromEmail(editedEntity.getEmail())));

        screenBuilders.lookup(Organization.class, this)
                .withScreenClass(OrganizationBrowse.class)
                .withOptions(options)
                .build()
                .show();
    }

And the organization browse screen contains what I’ve been trying:

    @Subscribe
    public void onInit(InitEvent event) {
        ScreenOptions options = event.getOptions();
        if (options instanceof MapScreenOptions) {
            if (((MapScreenOptions) options).getParams().containsKey("name")) {
                filterNameValue = (String) ((MapScreenOptions) options).getParams().get("name");
                filterEmailDomainValue = (String) ((MapScreenOptions) options).getParams().get("emailDomain");
            }
        }
    }

    @Subscribe
    public void onBeforeShow(BeforeShowEvent event) {
        if (filterNameValue != null) {
            FilterEntity orgSearchFilter = filterService.getFilter("Organization Search",
                    "[registry_Organization.browse].filter");
            if (orgSearchFilter != null) {
                filter.setFilterEntity(orgSearchFilter);
                filter.setParamValue("name", filterNameValue);
                filter.setParamValue("emailDomain", filterEmailDomainValue);
            }
        }
    }

From previous forum posts that I’ve searched for, it’s been stated that the Filter API is somewhat limited. Is there a way to do what I’m attempting, or am I barking up the wrong tree?

Thanks in advance!
Adam