Send params when selecting a record that referenced

Good day

params

From the above attachment you would see a many to one referenced attribute that is encircled in red, which should open the referenced table to allow the user to select a record.

I wish to send a parameter when i click the encircled dots to open the reference table.
How do i achieve this??

Thank you in advance.

Hi,

you need to subscribe on ActionPerformedEvent and provide own implementation that opens lookup screen with params, e.g.:

@Inject
private LookupPickerField<Customer> customerField;
@Inject
private ScreenBuilders screenBuilders;

@Subscribe("customerField.lookup")
private void onCustomerFieldLookup(Action.ActionPerformedEvent event) {
    Map<String, Object> params = ParamsMap.of("param_name", "param_value");
    screenBuilders.lookup(customerField)
            .withOptions(new MapScreenOptions(params))
            .build()
            .show();
}

In a lookup screen you can handle passed params:

@Subscribe
private void onInit(InitEvent event) {
    MapScreenOptions options = (MapScreenOptions) event.getOptions();
    ....
}

Alternatively, you can inject window param with the @WindowParam annotation in case you know its name and type, e.g.:

@WindowParam
private List<UUID> excludedCustomers;

Regards,
Gleb