Unleashing Dynamics 365 Excellence: Your Source for Pro Tips and Snippets at D365Snippets.com

Our blog provides a curated collection of tips, tricks, and code snippets that streamline your workflow and enhance your proficiency.
Unleashing Dynamics 365 Excellence: Your Source for Pro Tips and Snippets at D365Snippets.com

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

0

what-is-an-extended-data-type-in-dynamics-365-and-how-to-create-extended-data-types-in-microsoft-dynamics

In the previous article, I explained how to create a label file and to use a label file to display texts and titles on user interfaces. In this article, I will explain Extended data types (EDTs).

What are Extended Data Types (EDT) in D365?

Extended data types commonly referred to as EDTs are user-defined types, based on primitive data types like boolean, integer, real, string, and date, and the composite data type container. You can also base EDTs on other EDTs. An EDT is a primitive data type or container with a supplementary name and some additional properties. 

For example, You can create one EDT named Description with the property StringSize is 100 characters, which is derived from a Base primitive data type string. This newly created EDT you can use anywhere instead of using the primitive data type string. 

So, in standard development, we use EDTs instead of primitive data types. Microsoft also provides some standard EDTs, these EDTs you can use in variable and field declarations in the development environment.

Benefits Of EDT

1. We can put some meaningful name for EDTs for our newly created variables. For example Name instead of a string. Hence the coding will be easier to read and understand.

2.  The properties you set for an EDT are used by all instances of that type, which reduces work and promotes consistency. For example, An EDT “Name” with StringSize is 10 characters, which can be used in different table fields where you want to save the names like customer name, supplier name, employee name, etc.  In the future, if we want to increase the StringSize of the customer name, supplier name, and employee name to 20 characters. you can easily change the StringSize property of EDT “Name” to 20. This will reflect all the associated table fields automatically means all fields based on this EDT will be adjusted; and if we reduce the size, it will truncate the values to the new size.

3.     You can create an extended data type in the Application Object Tree (AOT) that contains multiple elements. This enables you to store multiple data elements in a single field that is based on this extended data type.  A typical example is an extended data type for handling an address. Instead of defining three fields on your form to enter the address, you can define an extended data type with three elements (the first element exists by default), as shown in the following figure.

4.    You can create a relationship with the help of EDT.  

Read More:  How to create Auto Lookup Using EDT with Table Reference.

How to create an Extended Data Type (EDT) in D365?

If you are a beginner or a learner, you can use Microsoft’s learning platform for practicing D365 FO scenarios. There you can access both the technical and functional environments for practicing more.

Here we will create one EDT named “Remarks” with property StringSize is 20, and then will create two tables “TblCustomer” with two fields “CustName” and “Remarks” and another table “TblVendor” with two fields “VendName” and “Remarks”.

We will assign the EDT Remarks to the Remarks fields of both tables.

To create the EDT, follow these steps:

1. Right-clicking on solution explorer and choose Add | New Item.

2. Select Data Types in the left-hand list, and then select EDT String.

3. In the Name field, enter the name of EDT, in our case, I put Remarks and then press Add button.

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

Now you can see the EDT is created under the Solution Explorer under the Folder Name EDT string, the folder will automatically be generated based on the type of EDT you created.

The next step is, we need to set the property StringSize to 20,

For this Right click on the EDT and select the Properties menu as shown in the below figure,

Right-click EDT > Properties> StringSize to 20 characters.

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

As we already mentioned, in our example we are assigning these EDT Remarks to the Remarks fields of the two different tables TblCustomer and TblVendor. So, we need to create these two tables,

For this, by Right-clicking on solution explorer and choosing Add | New Item, under Data Model you can create two tables TblCustomer and TblVendor as shown below.

Table Vendor

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

Table Customer

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

Now we created two tables TblCustomer and TblVendor, TblCustomer has two fields CustName and Remarks and TblVendor has two fields VendName and Remarks.

The next step is we are assigning the StringSize property of the Remarks field of TblCustomer and TblVendor to 10,

For this right click on the Remarks field of two Tables and set the property StringSize to 10 characters as shown in the figure.

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)


What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

Now we are going to assign the EDT Remarks to the Remarks field of the two tables TblCustomer and TblVendor. 

For this, Right click on the table field Remarks and select the property Extended Data Type, and assign the EDT, in our case select the EDT Remarks as shown in the below figure.

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)


What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

Now you can see the StringSize property of the field Remarks of both tables has been changed from 10 to 20 as shown in the below figures. This is because the StringSize of EDT Remarks is 20. When we assign the Extended Data Type property of tables it will reflect all the associated table fields automatically means all fields based on this EDT will be adjusted; and if we reduce the size, it will truncate the values to the new size. 

Now you can see the StringSize property of the field Remarks of both tables has been changed from 10 to 20 as shown in the below figures. This is because, the StringSize of EDT Remarks is 20. When we assign the Extended Data Type property of tables it will reflect all the associated table fields automatically means all fields based on this EDT will be adjusted; and if we reduce the size, it will truncate the values to the new size.

Now you can see the StringSize property of the field Remarks of both tables has been changed from 10 to 20 as shown in the below figures. This is because, the StringSize of EDT Remarks is 20. When we assign the Extended Data Type property of tables it will reflect all the associated table fields automatically means all fields based on this EDT will be adjusted; and if we reduce the size, it will truncate the values to the new size.

In the future, if you have a requirement to increase the StringSize of the fields of the two tables TblCustomer and TblVendor to 100. You can easily change the StringSize of the EDT, this will automatically reflect all the associated fields of the tables. 

Here I have changed the StringSize property of EDT Remarks from 20 to 100, you can see automatically the StringSize of the Remarks Fields of two tables TblCustomer and TblVendor have increased to 100.

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

What is Extended Data Types (EDTs) in D365 and How to create Extended Data Types(EDTs)

In standard customization, we must deal with hundreds of tables and different elements in our application, so by using EDT, you can reduce effort and time also which promotes consistency. If this article is useful, please share it with your friends. Happy coding with D365 Snippets.

Post a Comment

0Comments
Post a Comment (0)