Dynamics 365 Business Central Web Services and Excel Reporting
Originally posted on February 4, 2020
I recently had a client ask for a Fixed Asset report that included the asset number, description, location code, posting group, global dimensions, acquisition cost and book value. The client had already reviewed every report available within Business Central and wasn't able to find one that provided all the information he was looking for in one report. By the time he reached out to me he was desperate for help to get this information in one spot.
I instantly thought I could accomplish this task using Web Services and Excel. I started the process by figuring out where the information needed was stored within BC. A lot of the information was right within the Fixed Asset Card, however silly enough the acquisition cost wasn't there. I found the acquisition cost in the FA Ledger Entries window.
"Business Central supports two types of web services: SOAP and OData. Web services are a lightweight, industry-standard way to make application functionality available to a variety of external systems and users" (Source: Microsoft Docs). Since OData is supported within Microsoft Excel I decided to go this route.
The cool thing about doing it this way is you can save the Excel file locally and when you open it you can refresh the data so it's always up to date.
1. Identify where the information is stored. The two windows identified were the Fixed Asset Card and FA Ledger Entries window. I used the Page Inspection tool to determine the page number for the Fixed Asset Card window.
Window Name Page
Fixed Asset Card 5600
FA Ledger Entries 5604
2. Open up Web Services list and search for the two pages to see if they already exist. If they don't then set them each up by clicking on +New and selecting the Object Type = Page, Obect ID = 5600, Service Name = FixedAssetCard (same as Object Name without spaces), select Publish. Once you've completed this task for both pages you're ready to move onto step 3.
*NOTE: regarding the FA Ledger Entries page identified in step 1 the system wouldn't allow me to use the page 5604, so I instead used a query = 267 as shown below.
3. You now ready to start developing the report within Excel. Open up Excel and start a blank document. Within Excel click on the Data tab then Get Data > From Other Sources > From OData Feed.
4. Within the Web Services list right click on the OData URL and copy link, paste that link into the OData Feed window in Excel. Select OK.
5. Sign in using your Organizational Account.
6. Next you're given a preview of the data and how it will be organized. You have the option to load the data or transform data. Personally I like to transform the data first before bringing it into Excel so I can clean up the data and remove any columns I don't want displayed.
7. Transform data using Power Query Editor. Just like Excel you're able to right click on a column header and 'remove' the column. You're also able to add columns with conditional formatting if needed within this tool. To learn more about Power Query Editor click here.
8. Once you have the data and columns how you want them simply click on Close & Load in the top left. Power Query Editor will close and the data will be populated within Excel.
9. Repeat steps 3-7 in a second tab within Excel to bring the other page into Excel.
10. Within Excel you can now create a report with the needed information.