When entering filter values in the filter pane in the Business Central web client, users can enter filter tokens [% + reserved word] that resolve to a filter value or a filter expression. The reserved word can be written in small letters or completely in capitals, or even be translated – more on that soon.
Unfortunately, there is no docs article to summarize all standard filter tokens. Instead, they are spread over the docs and GitHub, so here is my attempt to fill the gap. First, we will learn about all available filter tokens per data type, and then we will look at their implementation in code, followed by a link on how to add your own ones.
Text or Code fields
Expression | Supported field | Result |
---|---|---|
%me or %user | User ID (not in system fields) | All records that are assigned to you. |
%company | any Code or Text field | The current company name. |
%mycustomers | Customer No. | All customers that are included in the My Customers list on your Role Center. |
%myitems | Item No. | All items that are included in the My Items list on your Role Center. |
%myvendors | Vendor No. | All vendors that are included in the My Vendors list on your Role Center. |
The expression may differ per client language: In German, you can use %meinedebitoren
instead of %mycustomers
– or both.
Date, Time or DateTime fields
There is a variety of date or time related filter tokens – however, mostly date fields are supported:
Expression | Date | DateTime | Time |
---|---|---|---|
%today | x | x | n. a. |
%now | x | Only as %NOW | Only as %NOW (fixed in BC 24) |
%workdate | x | x | n. a. |
%yesterday | x | missing | n. a. |
%tomorrow | x | missing | n. a. |
%week | x | missing | n. a. |
%month | x | missing | n. a. |
%quarter | x | missing | n. a. |
If you want Microsoft to add the missing filter tokens for DateTime fields, then vote for this BC Idea: Support filter tokens for DateTime fields
In earlier versions, translated filter tokens for date or time related fields used to work in every casing. Since BC 23 (or earlier, I do not know), this seems to be broken: At least for the German client language, the translated token must be written in capitals: %JETZT
.
Implementation
The implementation is – again – spread over multiple places:
Base Application: codeunit 9150 “My Records Filter Sub.”
%mycustomers
%myitems
%myvendors
System Application: codeunit 58 “Filter Tokens Impl.”
%today
%workdate
%now
%yesterday
%tomorrow
%week
%month
%quarter
%user
%me
%company
You can also implement your own filter tokens: Adding Custom Filter Tokens.