In the previous article, we already discussed The model management in dynamics 365 F&O. In this article I will show how to add a new field to an existing table in dynamics 365 finance and operations. In most dynamics 365 finance and operations development, this is a common scenario.
How do achieve this task? is it possible to change the structure of existing base tables in dynamics 365? Yes, In dynamics 365 this task is achieved by using the extension method.
An extension is a way to add functionality to an existing object in D365FO without modifying the base code of that object. Your extensions are compiled into their own DLLs, which are separate from the D365 base system libraries.Â
It also makes it easier for Microsoft to patch their SYS layer code. Microsoft has added to allow customization without allowing the base code to be changed because they plan to not allow any overlaying of SYS layer code.Here I am showing you how to add one new field to the already existing CustTable by using Extension methods. A new remarks field to the CustTable.
If you are a beginner or new to dynamics 365 Finance & Operations, you can use Microsoft's Free Virtual Machine. Learn How to Set Up a Free Virtual Machine for Dynamics 365 Development.
How to do it
Create a model
- Under the Dynamics 365 menu, choose Model Management | Create model...
- The Model name is SalesModel and fill all the required fields with your values as shown in the below figure.
- Press the Next button.
- On the Select package page, choose Select Existing package. We are now offered a list of packages that we can refer to, these are listed as the package's name and the models that the package contains, check Application Suite and
- Press the Next button.
- The two checkboxes, Create a new project and Make this my default model for new projects, should both be checked.
- Press the Finish button.
- This opens the New Project dialog. The project name is CustomerModification.
- Then press the OK button.
- Now D365 F&O Project is created.
As we already discussed, adding a new field to an existing table in D365 F&O is achieved through the extension method. so here we are going to extend the existing customer table. In D365FO Customer Master table is named as CustTable So we are going to extend CustTable.
Extend Table CustTable
- Open Application Object Tree [AOT]. For this go to View->Application Explorer.
- Expand the Data Model node.
- Under Data Model, Expand Tables.Â
- Search the CustTable.
- Right Click On CustTable and click Create Extension.
- After a few seconds, one Folder name TableExtensions and table CustTableExtension1 is created under the Project CustomerModification in Solution Explorer Window.
- Double click on CustTable.Extension1.
- A designer window for CustTable.Extension1 opens.
- Expand the fields node.
- Right click on the fields node and select New-->String.
- The new customer remarks fields are String Data type.
- One string field is created name FieldString1.
- Right Click FieldString1 and go to Properties and change the Name Properties to "CustRemarks"
- Change Extended Data Type to the description.
- Change the Label Property to "Remarks".
Now Build the project by right-clicking the Project name from Solution Explorer. Only After the build process, this change is reflected in the Database level. Now table level customization is completed.
In the next article, I will show you how to add a new field in the table and add this field to the form.
if this article is useful, please share it on social media.Â