Today I would like to talk about how to filter data by the Business Central Web Client URL.
A few days ago we discussed how to enter criteria in filters in Business Central client.
And we also discussed how to add filters when using APIs before. More details: $filter
https://api.businesscentral.dynamics.com/v2.0/d8f36038-1f93-4543-affc-5dc92b6ee871/Sandbox03/api/v2.0/companies(6325c2d6-c92a-eb11-846e-000d3ac98e05)/salesOrders?$filter=customerNumber eq '10000'
Recently I was asked a question, they want to apply filters when opening BC through an external system. For example, directly open the Customer Ledger Entries page with customer number 10000. So in this post, I will discuss this topic briefly.
First of all, this can be done, similar to the method of the API above, we need to add filter parameters to the BC Web Client URL. But it is not written the same way as in the API.
As you might know, there are several parameters that you can add to the Web client URL to manipulate what is displayed in the client. For example, you can open a specific company, target a specific page, report, or table. The following URL displays page 9305 Sales Order List for the My Company:
You can filter the data that is displayed in the page by using the filter parameter. The filter parameter let you display specific records from the underlying table of the page.
The following address displays data in page 9305 only for the customer who has the Sell-to Customer No.=10000 and the Location Code=EAST.
https://businesscentral.dynamics.com/sandbox214?company=My%20Company&page=9305&filter='Sell-to Customer No.' IS '10000' AND 'Location Code' IS 'EAST'
Filter Syntax: The filter has the following syntax.
&filter='<field>' IS '<value>'[ AND '<field>' IS '<value>']
Include a space or
%20 before and after the
AND operators. You can add the filter anywhere in the address after
Filter Parameters: The following table describes the filter parameters.
|The name of the table field on which to filter.|
|Specifies the equal operator.|
|The value of the table field on which to filter.|
|Use this parameter to specify more than one filter. It specifies an “and” operator for adding additional filters. Place |
To be included in the page data, the table record must match values for all fields in the filter.
So the above problem can be solved simply by using the following Web Client URL. If you want the external system to generate BC URL automatically, you only need to satisfy this rule to do so.
https://businesscentral.dynamics.com/sandbox214?company=My%20Company&page=25&filter='Customer No.' IS '10000'
You can find more details about Web Client URL in MS Learn (Docs).
PS: Please note that the Card, CardPart, and Document pages cannot be opened using this method.
|Specifies a record in the underlying table of the page. The value of a bookmark is an alphanumeric string of characters, for example, |
For the page types Card, CardPart, and Document, the bookmark specifies the record that is shown in the page. For page types List, ListPart, and Worksheet, the bookmark specifies the record that is selected in the list on the page.
Important: Bookmarks are generated automatically. You can only determine a value for the bookmark by displaying the page in the Web client and looking at its address. So, a bookmark is only relevant when the address you’re working with was copied from another page instance.
Hope this will help.
Thanks for reading.