Filterpicker based on Objectpicker

I would like to do the following:
In a form:
Field 1: ObjectPicker
Field 2: Filterpicker

The filters shown in field 2 should be based on the selection of field 1. Since the FilterPicker control requires an attribute filterObject

Any idea how to solve this?


Great question :). In our “data visualisation” extension we have something along these lines:

<field binding="data_viz_metric.source_object" sortorder="20" control="dataVizSourceObjectPicker" />
<field binding="data_viz_metric.record_filter" sortorder="30" control="filterWidgetFilterPicker" filterBy="source_object,source_object" filterByField="filterObject,filter_object" disabledIfUnfiltered="true" quickadd="true" quickedit="true" />

That filterWidgetFilterPicker form control is actually to be found in the admin dashboards extension:

So that might provide some insights into how this has been achieved.

Another potential option is to only offer the filter picker once the object has been chosen. This could be achieved with some kind of pre add record screen that allows you to pick the object and submit. This submission could take you to the add record screen. The object name would be prepouated in a hidden field.

With this approach, you could use the add record screen/edit record screen customisations to provide options to the form field for the filter picker (providing the filter object param).

Make any sense?

This is probaly the best approach. Since we’re not allowing to change the object after the record was created this value won’t change.

1 Like