Hi, Readers.
Yesterday someone asked me a question about how to download the source code of some special Query objects. Such as query 2554 “Items By Location”. It was very interesting, so I decided to share it in this post.
First let’s see where these special Query objects are.
Open the Item List page. Choose All.
Then you can see some lists (Query) like smart lists. Yes, these Query objects are present in many pages now.
For example: Items By Location
If you open Page Inspection, you can see some details about the Query.
Query:
Items By Location (2554)
Extension:
“id”: “0737a5b0-34ce-4e13-b412-5d677dbccade”,
“name”: “_Exclude_Microsoft Dynamics 365 – Smartlist”,
“publisher”: “Microsoft”,
“version”: “17.4.21491.0”
First of all, these query objects cannot be found inside Base Application and System Application.
It cannot be found in the On-Premises installation package either.
So how to download the source code?
There are two ways.
1. Add new dependency to app.json in VS Code.
From Page Inspection, you can get all the information about “_Exclude_Microsoft Dynamics 365 – Smartlist” extension.
So add them to app.json file.
{
"id": "0737a5b0-34ce-4e13-b412-5d677dbccade",
"name": "_Exclude_Microsoft Dynamics 365 - Smartlist",
"publisher": "Microsoft",
"version": "17.4.21491.0"
}
Redownload symbol files. Then you will see that the “Microsoft__Exclude_Microsoft Dynamics 365 – SmartList_17.4.21491.21867.app” file has been downloaded.
After unzipping the app file, you can get all the source code.
2. Get to the source code of the default apps by Business Central Artifacts
The prerequisite is that the BcContainerHelper must already be installed.
Run the following command in Windows PowerShell ISE.
For example: Download the source code of the latest available version.
Download-Artifacts -artifactUrl (Get-BCArtifactUrl) -includePlatform
Download Start.
Download completed. (About 3-10 minutes)
Then you can find the source code that has been downloaded in folder “C:\bcartifacts.cache\sandbox\”.
Then all the app files will also be downloaded to the “C:\bcartifacts.cache\sandbox\17.4.21491.22792\w1\Extensions” folder at the same time. Including “Microsoft__Exclude_Microsoft Dynamics 365 – SmartList_17.4.21491.21867.app”.
Then you can extract the app file and view the source code, as above.
PS:
1. You can add some parameters to the Get-BCArtifactUrl command to download the source code you need.
For example:
View the latest version of JP region.
Get-BCArtifactUrl -country "jp"
View all version of Sandbox type.
Get-BCArtifactUrl -Type Sandbox -Select All
Download the source code for the specified version and region.
Download-Artifacts -artifactUrl (Get-BCArtifactUrl -country "jp" -version "15.4.41023.43672") -includePlatform
2. If you also want to add your own Query inside All of the pages, you can check out the blog below.
QueryCategory property – Smartlist? (Execute Queries from Pages)
END
Hope this will help.
Thanks for reading.
ZHU
コメント