Saturday, November 26, 2022
Monday, October 31, 2022
Disclaimer: this is just a short recap of what Martin Dráb explained in his article https://dev.goshoom.net/2012/08/purpose-of-code-reviews/.
Purpose of code reviews
- Internal quality:
- Overall approach – does the code do the right thing by proper means?
- Maintainability/extensibility – are we able to easily extend the solution, fix bugs etc.?
- Testability – are we able to test the code?
- Documentation – are we able to understand why the code was made and what it does?
- Performance – is the design correct from performance perspective?
- Functional testing: Some bugs are much more visible when looking into code
- Knowledge sharing: Discussions between the developer and the reviewer
- BP check
- DevOps code review request
Top 10 issues discovered from Dynamics AX Code Review
Wednesday, June 29, 2022
Union query may be a very efficient and useful option when you need to fetch similar data fields from different tables. A good example of this may be the case when you to gather information about project related transactions as they can be of different types, like, expenses, fees, items, etc.
Say, we need to render some report collecting all these different types of transaction that can be posted against a given project and group them by a given financial dimension value in Project group. Let's see how Union query can help us.
In order to better understand the goal, you can take a look to the standard form ProjInvoiceJournal which perfectly explains how all these table relate to each other.
Most of them contain the same set of fields, and we simply need to get some of them into one view to populate by the report data provider.
So, at the first step, let's create all necessary queries for the source Project transaction related tables. Pick up the first and create a simple query as depicted.
Then create a view based on this query.
Then pick up the next and do the same.
Complete these two steps for all necessary transaction types.
Now you can create a Union query and add all your views together as they have the same set of fields.
If you need to distinguish them later who is who, say, in computed column methods, you can use unionAllBranchId field, but this is out of the current focus.
Finally you can elaborate it by adding a new view based on the latter with a simple SUM aggregation for Amount field.
Basically, you achieve your goal with no coding.
I am not going into details about the whole project, which you can get by this URL https://github.com/wojzeh/tmxProjectSalesPerSegment. Ping me, if you have any questions.
Sunday, June 19, 2022
Yes, guys, sometimes they come back!
Fourteen years ago Vania Kashperuk created a class which became classics: SysMultiTableLookup. It made possible to create lookups based on multiple tables. Some people are still looking for it in vain among the standard classes. So I decided to create a new version of it for D365FO.
It combines supporting for both lookup and lookupReference methods: performFormLookup and performFormReferenceLookup.
Vania added a tutorial form to his class, so did I. There is a form in the project, which shows how unbounded form controls can be looked up with fields and display methods from joined tables as well as the case with aggregation and a CustTable data source to demonstrate a lookup for a reference group.
Take note that I did not implement resolving and have not tested it thoroughly, neither.
Feel free to use it and elaborate at your own risk.
The whole project tmxSysMultiTableLookup is here in https://github.com/wojzeh/tmxSystemTools
The only class is here
Saturday, June 11, 2022
Sunday, May 8, 2022
When it comes to upgrading attachments from AX2012 to D365FO, only URLs, notes, and files saved in the former's database may be transferred to the Azure Blob Storage (on-cloud).
Therefore, all files from attachments in AX2012 should be moved to the database first in order to be successfully migrated to D365FO.
What if there are millions of them? Technically speaking it might be a good option to save them on SharePoint (on-cloud); however, unfortunately, such attachments links will be deleted, too.
You can find more detail on Document management in D365FO in https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/fin-ops/organization-administration/configure-document-management
During the Ax2012-D365FO database upgrade process, among other standard classes ('scripts') ReleaseUpdateDB72_Docu is triggered, which actually deletes records in DocuValue and related tables for all files not saved in the data base including even those referenced on a local SharePoint server.
As a solution we can move all external files referenced in AX2012 attachments to a on-cloud SharePoint server first
Then an extension to the aforementioned class must be triggered during the standard DB upgrade procedure; so that it would keep existing links and update them accordingly to a new SharePoint folder structure.
For example, we can agree that existing local folders will be reproduced on the SharePoint Server instance.
The following code must be adapted accordingly to your landscape and tested first on a small set of files in a dev environment.
Please, use it at your own risk.
Saturday, April 9, 2022
If you need to provide an SSRS report with a multiple company selection, you can opt for a cross-company query. In this case, such an option will be maintained by the system automatically. (You can try this [SrsReportQuery(queryStr(LogisticsEntityLocationUnion))])
But what if you need to do that without the former? In this case you'll need to use LedgerLegalEntityLookup class as follows. Say we deal with some mgcSalesBySegment report, which is meant to return some data for a given selection of legal entities.
the whole project, which you can get by this URL https://github.com/wojzeh/tmxProjectSalesPerSegment. Ping me, if you have any questions.
I hid some not relevant code; so that you can get the gist.
Data contract mgcSalesBySegmentContract: we keep the user selection of companies as a string.
Report controller mgcSalesBySegmentController: if no companies selected, let's set it to the user's context.
User interface builder mgcSalesBySegmentUIBuilder: when an SSRS report runs, it shows its dialog twice: the second time in the report viewer, when the report is rendered. Thus we have to override dialog methods in the UIBuilder class to avoid the lovely 'Object reference not set to an instance of an object' error.
Report data provider mgcSalesBySegmentDP: we need just to convert the saved string back to a container, then we can loop through it as required by the report logic.