How to create a lookup in D365FO using X++?
Lookups are the standard way to display a list of possible selection values to the user. For a user, while editing or creating database records, a lookup makes the data entry easy and errorless. In Microsoft dynamics 365 finance and operations, there are many ways of creating lookups.
EDT and Table Relation Type lookups are the simplest
forms of lookups in Microsoft dynamics 365 finance and operations.
In this article, I will describe the very simplest type of lookup, which is EDT lookup, for making an EDT type lookup, a developer does not need to worry more about writing x++ coding,
Normally, standard lookups are created
automatically by the system in Dynamics 365 for Finance and Operations and are
based on the extended data types and table setup. They are based on table
relations and appear automatically. No additional modifications are required.
Why Use a Lookup Method?
Normally a look-up is used to list the master data in the system like customer master, vendor master, item master, etc. what will happen if a user is typing these values instead of selecting the values from the lookups.
Consider a supplier order form, there we can
select the vendor account using a lookup. Instead of selecting a vendor account
using lookup, if the user is trying to type the vendor account details there
are many chances to get an error in the input because the user doesn’t know the
vendor account which is existing in the database. Also, while selecting a
vendor from the lookup, a user can confirm the vendor by checking the other
lookup columns which display all the details about the vendor. So, about a
user, while editing or creating database records, a lookup makes the data entry
easy and errorless.
Setting Up an EDT Lookup
In this example, I am considering the standard EDT CustAccount which is already available in the system.
For this,
Open Application Explorer > Data Types > Extended Data Types.
Search the EDT CustAccount, Right click and select the
open designer menu, then the EDT will open in the designer window as
shown below.
Expand the Table Relation Node, there you
can see one table relation which is,
CustAccount == CustTable.AccountNum
If we are assigning this EDT CustAccount into the newly created field your Table, automatically customer account number is populated in the field. The newly created field is based on EDT CustAccount and therefore, it automatically inherits its relation. So the field will list the Customer Account details which are available in the system for the selected company.
Suppose we are creating a table TbleSalesMen
with three columns SalesManId, SalesManName, and CustAccountNum as shown in the
figure.
Where you are assigning EDT CustAccount to the
Extended Data Type Property of the field CustAccountNum as shown in the figure.
After the successful build of the project, right-click on
the table TblSalesMen, select the Open Table Browser menu
How it works...
The newly created CustAccountNum field is based on EDT CustAccount and therefore, it automatically inherits its relation.
Output
Related Tags
EDT lookup in d365fo
0 Comments:
Post a Comment