SysExtension framework pitfall: avoid new()

SysExtension framework pitfall: avoid new()

This research has been inspired by a real bug in the D365FO v. 10 (preview) application. It turned out that the SysExtentionAppClassFactory doesn’t explicitly call the new() method the 2nd time when it takes a previously resolved class name from the cache.

This is just good enough to pass an automated test or to fool a lazy tester, but in real life this may potentially result in run-time errors or other misbehaviour. Any code, any internal variable initialization you placed in the new() constructor is going to be bypassed the second time you call the same operation within the same client session.

To illustrate this, let’s use the demo project from my other blog.

Add the following code into the new() method of the MealCourse class:
abstract public class MealCourse
{
...
protected void new()
{
info ("Yummy!");
}
}

Create a new action menu item to call this class, and place it on any of the D365FO menus. Call it once:

Right, yummy-yummy-yummy!

Call it again from in the same window (do not reload the browser but just click the menu item the 2nd time):

Nothing. The new() method has not been called.

Conclusion

Do not rely on the new() method when using the SysExtension framework. Let it be empty, do not put any logic at all inside. Perform the variable initialization in a dedicated method or any of the parm() methods, and call them explicitly in your constructor right after the SysExtensionAppClassFactory ::getClassFromSysAttribute() call.

On the AXSCDPPKG file structure

On the AXSCDPPKG file structure

Application hotfixes for Dynamics 365 for Finance and Operations are distributed via AXSCDPPKG (AX Source Code Deployable Package) files. They can be downloaded from the LCS Issue Search page. The deployment process with the help of the SCDPBundleInstall.exe utility is described in this working instruction.

However, prior to the installation you may want to quickly review the code to check if this is what you are looking for. The LCS Metadata hotfix is nothing but a set of 3+ nested ZIP files, quickly recognizable by the “PK” magic bytes in the header:

 

  1. Unpack the MicrosoftDynamicsAX_KBxxxxxxx.zip file as downloaded from the LCS.
  2. Rename the HotfixPackageBundle.axscdppkg file into a ZIP, unpack it. There are at least 2 files inside: one or many (for cumulative hotfixes) nested DynamicsAX_xxxxxxx.axscdp files, and a diagram with their dependencies PackageDependencies.dgml. The dependencies are well described by Mr. de Cavalon in his blog.
  3. Rename, unpack the nested DynamicsAX_xxxxxxx.axscdp. There is a set of application folders (Deltas) with a list of all affected application objects in PackageManifest.xml.
  4. Traverse the Deltas folder to the bottom. There is an XML file like this with the source code before the update (<Original> … </Original>) and after (<Yours> … </Yours>) in a human readable form, as maintained by the TFS source code versioning system.

Update 25.01.2019
A reader pointed to a recent article about the same topic:
https://community.dynamics.com/365/financeandoperations/b/axsupport/archive/2018/10/19/inspecting-a-d365fo-meta-data-hotfix-content, or Inspecting-a-D365FO-Meta-Data-Hotfix-Content.docx

WHS Emulator screen in Dynamics 365

WHS Emulator screen in Dynamics 365

I realise the WHS Emulator form in D365FO may be widely known in our circles, but I’d like to recapitulate the options how to access the Warehouse management mobile device interface if you have no scanner on hand, or if the endpoint for the Dynamics 365 for Finance and Operations – Warehousing App has not been shared.

N.B. I love the parental control for this app: PEGI 3; don’t let your toddler play with the forklift unattended.

Open the emulator screen in the browser by navigating the menu item URL:
https://xxx.operations.dynamics.com/?mi=action:WHSWorkExecute

or with the help of the SysClassRunner tool:
https://xxx.operations.dynamics.com/?mi=SysClassRunner&cls=WHSWorkExecuteForm

What may be displayed on multiple cards on the scanner, is shown on the single screen in the emulator:
App UI versus Browser UI
Hit the <Enter> key as you type in data to trigger events on the emulator screen and let the system populate dependent fields.