Multiple table fields custom lookup in AX 2012
Hi Friends,
Today, in this post we are going to share how you can add multiple tables fields custom lookup in AX 2012.
Let's take a scenario to understand the requirement first...
We need to make custom lookup for Product Number from EcoResProduct table and Item Number from Invent Table.
For this type of requirement first create a query by joining these two tables and then add query and fields in view.
Steps to follow:
1. Create a new query and drag and drop InventTable from AOT in it.
2. Set the fields property Dynamic = No and add ItemId in fields.
3. In InventTable data source drag and drop EcoResProduct table from AOT.
4. Set the fields property Dynamic = No and add DisplayProductNumber in it.
5. Set the Fetch mode = 1:1 and Relations = Yes for EcoResProduct data source property.
6. Query is ready to use to add in View. Let's create a view.
7. Create a view and add your query in it.
8. Add fields which you want to show in the view.
9. Write custom lookup logic on form control like below. If you don't know how to create custom lookup click here.
10. Done.
We hope this solution helped you to add multiple table fields custom lookup on form control using X++ in AX 2012. Please comment your valuable feedback for this article...
Author:
Chirag Gupta
Microsoft Dynamics D365/AX 2012
Senior Technical Consultant at IBM Bangalore
Date:
6-Apr-2020
Happy Learning !!
Today, in this post we are going to share how you can add multiple tables fields custom lookup in AX 2012.
Let's take a scenario to understand the requirement first...
We need to make custom lookup for Product Number from EcoResProduct table and Item Number from Invent Table.
For this type of requirement first create a query by joining these two tables and then add query and fields in view.
Steps to follow:
1. Create a new query and drag and drop InventTable from AOT in it.
2. Set the fields property Dynamic = No and add ItemId in fields.
3. In InventTable data source drag and drop EcoResProduct table from AOT.
4. Set the fields property Dynamic = No and add DisplayProductNumber in it.
5. Set the Fetch mode = 1:1 and Relations = Yes for EcoResProduct data source property.
6. Query is ready to use to add in View. Let's create a view.
7. Create a view and add your query in it.
8. Add fields which you want to show in the view.
9. Write custom lookup logic on form control like below. If you don't know how to create custom lookup click here.
10. Done.
public void lookup()
{
Query query = new Query();
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(PKA_IntercompanyProductSetup), this);
;
sysTableLookup.addLookupField(fieldNum(PKA_IntercompanyProductSetup, DisplayProductNumber));
sysTableLookup.addLookupField(fieldNum(PKA_IntercompanyProductSetup, ItemId));
qbds = query.addDataSource(tableNum(PKA_IntercompanyProductSetup));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
{
Query query = new Query();
QueryBuildDataSource qbds;
SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(PKA_IntercompanyProductSetup), this);
;
sysTableLookup.addLookupField(fieldNum(PKA_IntercompanyProductSetup, DisplayProductNumber));
sysTableLookup.addLookupField(fieldNum(PKA_IntercompanyProductSetup, ItemId));
qbds = query.addDataSource(tableNum(PKA_IntercompanyProductSetup));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
We hope this solution helped you to add multiple table fields custom lookup on form control using X++ in AX 2012. Please comment your valuable feedback for this article...
Author:
Chirag Gupta
Microsoft Dynamics D365/AX 2012
Senior Technical Consultant at IBM Bangalore
Date:
6-Apr-2020
Happy Learning !!
Comments
Post a Comment