Form filter example (Dynamics 365 FO)

Form Filter example

This document described how to customize a form filter with two filters which have an ‘OR’ relation with each other.  We place the filter fields in the header section of the form as shown in screenshot below. In our example filter fields should have a lookup to the CompanyInfo Table, so the form filter controls should be linked to EDT “companyInfoRecId”.

Create filter group with filter controls at the correct place is under the ‘TabPageGrid’ Tab of the form as shown in screenshot. As both filter fields have to show company ID lookup, we can link EDT of these form filter controls to the EDT CompanyInfoRecId, which is an INT64 type.

The form filter controls we created are of the type “FormReferenceGroupControl”, so when we create a New formcontrol we select option “Reference Group”.

Be aware that filterfields should be added in the ‘filter’ group of the ‘TabPageGrid’ Tab page.When we added the filter fields in the design,design tree looks like this:









The filter controls should also linked to the correct EDT. In our example EDT of the form control is extended  with ‘CompanyInfoRecId’.



We take a closer look to the CompanyIfoRecId EDT. Here we can see the link to the CompanyInfo table in the ‘Reference Table’ property.

Now we have to create the following code in the execute query method of the datasource. We would like to use an ‘OR’ condition between the filters and therefore we use a ‘wildcard’ if one or both of the ranges are empty.

In the ‘modified’ method of the control we make following modifications:












Also check caching properties for the table:









If cache parameter is set to ‘NotInTTS’ it’s not working. Please select option ‘Found’ instead.