Dynamics 365 Blog - best_practice - Microsoft Dynamics 365 for Finance and Operations

Subscribe to RSS feed of this category
Suppress Best-Practice DeviationsIn principle, every solution in Dynamics 365 for Finance and Operations should be free of best-practice deviations, but sometimes there is the need to suppress them. Such a case are for example, event handlers that have a predefined parameter profile, but if one of these parameters is not used, it causes a BP deviation. class MyFreeTextInvoiceHeaderFooterTmpEH { [DataEventHandler(tableStr(FreeTextInvoiceHeaderFooterTmp), DataEventType::Inserting)] public static void FreeTextInvoiceHeaderFooterTmp_onInserting(Common sender, DataEventArgs e) { FreeTextInvoiceHeaderFooterTmp freeTextInvoiceHeaderFooterTmp; freeTextInvoiceHeaderFooterTmp = sender; if (freeTextInvoiceHeaderFooterTmp.CompanyBankAccount == "") { freeTextInvoiceHeaderFooterTmp.CompanyBankName = "Unknown"; } } } With the above EH, the following BP deviation would be output because the parameter e is not used:
|
Run best-practice checks from the command lineUsually the best practice checks are run during the build of a project/a solution. Sometimes, however, it can be quite practical to run them separately from a build. Therefore Microsoft offers us the XppBp-Tool, see https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/dev-tools/author-best-practice-rules (at the bottom). This tool is located in the PackagesLocalDirectory\bin directory and can be used as follows: Xppbp.exe -module:MyModel -model:MyModel -metadata:"C:\AOSService\PackagesLocalDirectory" -all |
Install and use Dynamics Application checkerA colleague of mine has brought to my attention the Dynamics Application Checker, which can be used to implement advanced best practice checks. The used XQuery files can be downloaded from GitHub. How to use them I try to describe here.
|
|
|
|
|
|
|
|
I have had the problem in the past that the BP test did not find all expected deviations or even the following error was issued:
In all these cases it has helped to disable the following rule: BPCheckTableDimensionFields
I found the decisive tip in the Dynamics 365 Community