Skip to main content

Posts

Debugging 365 using the info class

 A good and often used trick to use when hunting down bugs is putting a break point in the info class in the method add() and examining the call stack when an error is thrown causing the add method in the info class to be called for updating the infolog. However sometimes when you are debugging in Visual Studio the debugger will not load the symbols needed to debug in the info class. In the old days you had to resort to the very slow "Load all modules, unless excluded" under Debugging / Symbols / Automatic symbol loading preference, which would load symbols for ALL modules. A neat addition that Microsoft has added to the Dynamics 365 FO/SCM extension for Visual Studio (can't remember from what version at the moment), is that you can now debug with "Load only specified modules". So when you encouter that the debugger will not load symbols for the info class do this: 1. Choose Options in the 365 Visual Studio extension 2. Go to Dynamics 365 / Debugging 3. Put a ch
Recent posts

x++ great but sometimes weird and annoying ....

Preamble: This occurred running on Finance and Operations (Dynamics 365) - (Platform Update57) 7.0.6861.86 extension for Visual Studio. Historically the x++ langauge has not had great support for access modifiers. The original workings was, that all class members in a class were private, and could not be accessed, by code outside the class, unless ofcourse you made a (parm) method giving access to change or just get something. Methods could have access modifiers but they were seldom used and were always public, unless you explicitly wrote something else. Somewhere a long the lines in D365 x++ has evolved to be more c#-like and therefor you can now put access modifiers on you class members, so that if you declare a class member public, you do not actually need to write an access (parm) method. However, the x++ compiler has it's quirks it seems. Consider this class declaration: internal final class MOLSOPackingSlipFromReceivedTransitGoodsUpdater {      public Q

The troubles of extending/correcting a lookup doing a wrong filter when the lookup is based on table relations

 Working in the WHS module a customer needed to be able to change the transport provider (carrier) and the provided service (carrier service) directly on the Shipment chosen in the pack form. This presents some interesting challenges, working within the limits of the extension mechanisms in D365. Firstly as of time of writing the application implements a table relation on the WHSShipment table to the table TMSCarrierService (transport service codes provided by a carrier). It does so by having a Normal field relation between TMSCarrierService.CarrierServiceCode and WHSShipmenttable.CarrierServiceCode, thus NOT taking in to consideration the Carrier that have been chosen on the shipment. Trouble is that you can not change a table relation using extensions, AND you can not using extensions to introduce a new (correct) relation that overrides the existing one. So instead of just changing the table relation (if that was possible and simple), I needed to do 4 extensions. 1) A new class with

Please upvote this idea for Visual Studio for Dynamics 365fo/scm

" When ISV solutions are installed as binary only, the current development tools does not support displaying delegate methods, and there are no interaction to copy the enventhandler method. Please add the Option to see the class in design view and from here se and copy event handler methods, Or display them directly from the Application explorer and make the interaction here. " Please vote: https://experience.dynamics.com/ideas/idea/?ideaid=a5d9dd10-a651-ec11-a3ee-0003ff459fb2

ProcessGuide framework

I was tasked with developing a custom "process" for printing ad hoc labels in the Dynamics 365SCM WHS app. WHS process guide - development docs Reading the great articles from 1clickfactory (starting point  https://www.1clickfactory.com/blog/advanced-whs-mobile-device-development-part-1-process-guide-framework/) gives a good starting point. Especially Edgaras' tip on running  SysExtensionCache::clearAllScopes();  in a runnable class after introducing a new step/pagebuilder class combination  is VERY useful. And of course Microsoft's own documentation ( https://docs.microsoft.com/en-us/dynamics365/supply-chain/warehousing/process-guide-framework ) also helps. However, I wanted to chip in with a couple of things. Extending WHS base enums If you extend the WHSActivity, WHSWorkExecuteMode or WHSWorktransType base enums with new options it is a good idea to run a database synchronization when you are done with extending them. Otherwise you might be frustrated to find, tha

Suppressing the infolog

Supressing the infolog is often useful in D365FO when augmenting code. When augmenting code using COC (Chain Of Command), you can have new code run either before or after the code you are augmenting. This means that any infolog-messages that the standard application code does, will be shown to the user, even if your augmentation supports a scenario where there must be no infolog-messages. How do you avoid the standard application infolog-messages ? To the rescue comes temporary supression of the infolog. The suppression consists of: 1) Saving the current infologLevel 2) Setting the infologLevel to SysInfologLevel::None 3) Run your code 4) Restoring the saved infologLevel to the infolog For example a table could have a validatewrite-method that validates that you are only allowed to use 3 out of 6 options in an enum-field, and you need to allow for a fourth one. Table a - validateWrite method: boolean validateWrite() {     Switch (this.enumField)     {         boolean ret;         case

Be careful - only do extensions of a table, that actually contains augmentation.

 Note to self. Be careful of creating extensions to a table, that contains no augmentation. I experience problems when opening the Released Products Forms on my developer box. I got a run-time error " Object reference not set to an instance of an object"  when opening the form. The error also occurred when changing records in the form, BUT strangely enough ONLY the first time the cursor arrived a at record. The second there was no problem.  Researching a bit with the debugger, I could see that the error occurred at the super() call in the FormRun class, and in the active method on the EcoResProduct datasource. I discovered that I by accident had created an extension to the table EcoResProduct that contained NO augmentation what so ever. Double checking that the extension had not been checked in to azure DEVOPS, and that the xml-file for the table extension in  K:\AosService\PackagesLocalDirectory\xxxxxDev\xxxxxDev\AxTableExtension contained no augmentation, I deleted the exte