Dynamics 365 Business Central: Filtering Data by the Web Client URL

Dynamics 365 Business Central

Hi, Readers.
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:

https://businesscentral.dynamics.com/sandbox214?company=My%20Company&page=9305

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'

Test Video:

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 ISand AND operators. You can add the filter anywhere in the address after /?.

Filter Parameters: The following table describes the filter parameters.

ParameterDescription
fieldThe name of the table field on which to filter.
ISSpecifies the equal operator.
valueThe value of the table field on which to filter.
ANDUse this parameter to specify more than one filter. It specifies an “and” operator for adding additional filters. Place AND between each additional filter.

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.

ParameterDescription
bookmarkSpecifies a record in the underlying table of the page. The value of a bookmark is an alphanumeric string of characters, for example, 27%3bEgAAAAJ7CDAAMQA5ADAANQA4ADkAMw%3d%3.

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.

END

Hope this will help.

Thanks for reading.

ZHU

コメント

Copied title and URL