Posts

Showing posts from 2020

Find D365FO error in event viewer

Image
D365FO has many event logs for tracking what errors might occur which can be accessed from the Event viewer. But it can be hard to find what log to look in when investigating an issue. To make things easier when looking for an error, create a custom view. Select what events you want to capture, events from the last hour and the Dynamics logs. I recommend looking at the last hour since D365FO will write a lot of events to the log and this will narrow the scope. Reproduce the error and go through the custom view to try and find what errors D365FO is writing to the event log.  

Execute and access code restricted internals as a partner or customer

Image
It's possible to bypass the internal access modifier that is used to protected code in Dynamics 365 for Finance and Operations from being executed by partner or customer code. This is possible since the standard models that is provided by MS in each release contain a Descriptor file that haven't been clean up and still contain a list of model names under InternalsVisisbleTo . All models that are listed under InternalsVisibleTo can reference/call code that has been marked as internal. See for example: K:\AosService\PackagesLocalDirectory\ApplicationSuite\Descriptor\Foundation.xml Most of the models listed under the tag InternalsVisisbleTo are unit testing models that are not shipped with the release. This makes it possible for a partner or customer to create a model with the same reference name and that way gain access to executing any code that should only be accessible by your core MS models. Since you have test models for most of your models this give

Technical intro to Feature management in D365FO

Image
Feature management is an alternative to configuration keys for releasing and introduce a new features into D365FO.  MS is still releasing updates around the framework but the existing state as per 10.0.9 provide all we need to get started with releasing functionality that is controlled by the feature management framework.  The key to the feature framework is the feature class, in my example below see the class  pekTestingFeature. It is used as a descriptor for the feature and the flag to indicate if the feature is enabled or not. Once the class is created and compiled, users can navigate to Feature management  under System administration  and enabled/disable the feature. It is possible to make a feature enabled by default or disable the possibility to disable the feature. If the feature doesn't automatically appear, run the Check for updates button.   The feature class can be applied to menu items and menus. If enabled the menu item or menu will be visible to the

Creating a self-refreshing form

This is a example on how to make a form periodically refresh it's data source. In this example there is a long running data upgrade running in the background and this form will refresh itself to display the progress as the log table (company, class name, method name).

Test driven development and X++

Test driven development (TDD) is a great way to work with unit testing in D365FO development. There are multiple benefits working with and introducing automatic tests for your code base. You’ll code correctly faster,  Good tests make good documentation You won’t forget to write the tests You’ll write more meaningful tests when you test before code It makes introducing changes later in ALM easier It pushes you to write cleaner code, smaller pieces of code to make testing easier.  The principles of TDD are as follows.  You are not allowed to write any production code unless it is to make a failing unit test pass. You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures. You are not allowed to write any more production code than is sufficient to pass the one failing unit test.  If followed they will ensure that the developer is either working on writing test code or business logic. In X++ it's easy to f

Using Git as source control with MSDyn365FO

Much recommended article on how to setup and work with Git as source control when developing for MSDyn365FO.  Read more here,  https://msdyn365fo.wordpress.com/2020/01/16/using-git-with-msdyn365fo/  .  See my example repository here ,  https://github.com/ponekbladh/d365foblog

Error 'RetailChannelAttributeModifier' for the field 'Modifier' is not found.

Compile error: Enum type 'RetailChannelAttributeModifier' for the field 'Modifier' is not found. Solution: Refer Retail model in your custom model