Create or extends 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 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, Enterprise edition, added several enhancements to improve extensibility of business logic and continue to add features in monthly platform update to improve further.  You can extend or customize business logic by defining event handlers and plug-in classes. You can now author event handlers on several pre-defined events on tables, forms, form data sources, form controls, and others. Plug-ins are also a new extensibility concept that enables replacing or extending the business logic of the application.
  • 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. Do not keep the commented code if you want to avoid the upgrade and maintenance costs. Keep the older version of the code in version control.
  • Where to add the custom code: Create the customizations at the appropriate location. Create the 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, several business logic can be implemented in .NET programming languages much easily than in X++. Now in you can easily build extended business logic in C# or any other programming language and use it with 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