Contents
How do you add a custom filter token?
To add your custom filter token, you need to define the token word that users will enter as filter criteria, and define a handler that resolves the token to a concrete value at runtime. For more information, see Filter Tokens in our ALAppExtensions repository on GitHub.
How are tokens used in the filter pane?
In the client, when filtering lists using the filter pane, users can enter filter tokens, which are special words that resolve to one or more values. This powerful feature makes filtering easier by reducing the need to navigate to other pages to look up values to enter as filter criteria.
How to subscribe to the make textfilter event?
Subscribe to the OnResolveTextFilterToken event associated with the MakeTextFilter method from the Filter Tokens codeunit. In the event subscriber, if the value of the TextFilter parameter contains the token string, process its value and construct the final filter string.
When to use event subscribers to resolve filter tokens?
When implementing event subscribers to resolve filter tokens, keep in mind that these events can be triggered from any user task in Business Central, and in some cases may be triggered repeatedly such as when searching across columns. To improve usability and reduce the impact on performance, do consider the following practices:
How to filter tokens in Microsoft Dynamics 365 Business?
To try it out in the client, open the Vendors page, filter on No. field, and type in a substring that starts the same way with the chosen token word, like %Div. I will show you how to use this on multiple page in my next blog.
Can a charfilter be used as a tokenizer?
“charFilters” can be one or more filters from Character Filters, processed before tokenization, in the order provided. Some character filters have options, which can be set in a “charFilter section. Character filters are optional. “tokenizer” is exactly one Tokenizer.