Create or extend business logic

The business logic is a part of a program or code that encodes the real-world business scenarios. In Dynamics 365 for Finance and Operations, Enterprise edition, the business logic can be written at multiple levels, such as the form UI, table method, classes, SSRS reports, and so on. The following headings describe the best practices when you customize the business logic in operations:

  • Reusing the code: As we explained earlier, Dynamics 365 for Finance and Operations provides numerous application frameworks. When developing the custom features, you should be able to extend the existing frameworks or reuse the code for your customization. The suggestion is to try not to reinvent the wheel, but investigate and utilize what is already available in the system.
  • Use extensions: Dynamics 365 for Finance and Operations added several enhancements to improve the extensibility of business logic and continues to add features that come with continuous service updates. With extensions, you can make use of available event handlers on tables, forms, form data sources, form controls, and others, plugin classes, and extend any object available in the system. With extensions, you can write business logic that's as simple as adding a new field or writing a whole new module without disturbing the core structure of the system.
  • Customizing the code: When the base layer code needs to be replicated or used in other places, it is always better to extend the existing classes and modify the derived class for the change in behavior, rather than creating completely new classes and then copying the entire code from the base class. Extending the standard business logic by extending the class will make it easier to upgrade the code. If you have created an extension, only the modified code must be restructured. Create classes and methods so that the same piece of code can be reused in multiple places. Avoid creating long methods. They make the code difficult to read, hard to debug, and extremely difficult to upgrade and maintain. 
  • Where to add the custom code: Create the customizations at the appropriate location. Create code for reuse as much as possible, but create it at the lowest appropriate location. For example, if something is required only in a form, do not put it at the table level. 
  • Using .NET projects and assemblies: Last but not least, business logic can be implemented in .NET programming languages much easier than in X++. Now, you can easily build extended business logic in C# or any other programming language and use it with an operations project as a reference. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.20.125