Extensions of final methods

Let’s assume that D365 F&O comes with the following class and we want to extend its showInfo() method: class Demo { public static void main(Args _args) { new Demo().showInfo(); }   public final void showInfo() { info("Base"); }   } Let’s try the usual approach, Chain of Command: [ExtensionOf(classStr(Demo))] internal final class Demo_Extension { public …

Continue reading ‘Extensions of final methods’ »

ID assignment in composite entity

When importing a composite entity with headers and lines to D365 F&O, you can let the system assign IDs and apply them to both headers and lines. For example, I can import the following file with sales order data: <?xml version="1.0" encoding="utf-8"?> <Document> <SALESORDERHEADERV3ENTITY> <ORDERINGCUSTOMERACCOUNTNUMBER>CustA</ORDERINGCUSTOMERACCOUNTNUMBER> <SALESORDERLINEV2ENTITY> <ITEMNUMBER>ItemA</ITEMNUMBER> <ORDEREDSALESQUANTITY>1</ORDEREDSALESQUANTITY> </SALESORDERLINEV2ENTITY> <SALESORDERLINEV2ENTITY> <ITEMNUMBER>ItemB</ITEMNUMBER> <ORDEREDSALESQUANTITY>2</ORDEREDSALESQUANTITY> </SALESORDERLINEV2ENTITY> </SALESORDERHEADERV3ENTITY> <SALESORDERHEADERV3ENTITY> …

Continue reading ‘ID assignment in composite entity’ »

Supporting conditions in print management

Print management in F&O (as well as in Dynamics AX) allows you not just to select the report design, print destination etc., but also do it conditionally, e.g. you may want to use different designs or footer texts for certain customers. In print management setup, you must first define a default setup (which doesn’t allow …

Continue reading ‘Supporting conditions in print management’ »

SysMock in D365FO

This post is about mock objects for unit testing in Dynamics 365 Finance and Operations, using the existing SysMock library. Mock objects are used to mimic behaviour of real objects to isolate the parts of code you want to test, to simplify test setup, to simulate specific responses and so on. SysMock is a library …

Continue reading ‘SysMock in D365FO’ »

Dependency injection in automated tests

When writing automated tests with SysTest framework, you often want to isolate the part you’re testing from the rest of the system. Otherwise your tests may fail for reasons unrelated to what you’re testing, you need to configure things that you aren’t really interested in, you may need external dependencies such as web services to …

Continue reading ‘Dependency injection in automated tests’ »