Skip to main content

Posts

Showing posts from December, 2020

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)     {     ...

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...