Posts

Showing posts from 2019

Deleting a private visual studio workspace

If for example a user has left your company or team and they have left a private workspace on a computer/vm that you need to recommission you might have an issue setting up your mapping if a folder is already mapped in the private workspace. To delete the the private workspace, open a visual studio developer prompt on the vm and run the following command. tf workspace /delete "WORKSPACENAME;PREVIOUSUSERACCOUNT"  

Bug or feature in D365FO forms when using composite query

Not sure if this is a bug or a feature but looks like a bug in the D365FO platform.  When you pass a composite query into a form using a menu item you can't filter on reference group fields. You get the error "Column is not filterable.". The data still will still displayed correctly, users just can't filter it.  Until the issue is resolved, use a simple query per menu item when passing to the form. 

Iterate enum values in D365 without BP errors

This is how to iterate enumeration values in D365FO without getting BP errors shown on the TableGroupAll enumeration. DictEnum enum = new DictEnum(enumNum(TableGroupAll)); if(enum != null) { for (int i = 0; i < enum.values(); i++) { TableGroupAll tableGroupAllEnumVal = any2Enum(enum.index2Value(i)); } }

Adding unit tests to legacy code

With the release of MS one version of D365FO automatic testing is becoming more important. These are some methods and tips on how to add a test harness to your legacy code. 1. Identify change points Start by looking at the class you want to add a test harness to, consider what needs to change in order to implement unit tests on it. 2. Find test points Test the public methods, not private methods. This way it's easy to make changes to the internal workings of the class in the future without affected what other classes depend on. 3. Break dependencies Add interfaces to the classes that the class you are work on depends on. Modify the class you are working on so that it depends on the interfaces that the dependencies implement instead of the classes and add the possibility to inject dependencies. For example by allowing injection of dependencies on the class creation. 4. Write tests Implement tests on the class, make sure they pass. 5. Make changes and refactor Make

SysTestCaseNumSeqModuleDependency doesn't support extension classes

This problem was discovered in 8.1 PU20. Using the attribute SysTestCaseNumSeqModuleDependency to load a number seq module doesn't load number sequences in extension classes. For example if you use  SysTestCaseNumSeqModuleDependency(classStr(NumberSeqModuleCustomer))  in a test and you're expecting it to load the number sequence from your XXXNumberSeqModuleCustomer_Extension  class where you have used chain of command to add a number sequence for an extended data type it will not be loaded. The following attribute can be used to load the single number sequence and it will work with the _Extension class. SysTestCaseNumSeqTypeDependencyAttribute(extendedTypeStr(XXXXXVoucher), classstr(NumberSeqModuleCustomer))