Question:
How can we create customized lookups in Dynamics AX
Answer:
One way of creating a custom lookup is by using the power of SysQuery. Lets solve this using a scenario, we want to create a customized vendor lookup that will be used on the Item form. We will define a vendor type and an item type and the vendor that matches the item type on the purchase order form shall be displayed in the lookup. So in order to get this output we will create a method lookupVendor() in the Vendor table and we will call this method from the overridden lookup() method of the Vendor.VendorId field of Vendor datasource passing in the item type from the form.
New method created in the Vendor table
public client static void lookupVendor(FormStringControl _ctrl,
VehicleVendorType _vehicleVendorType)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(VehicleVendor), _ctrl);
Query query = new Query();
QueryBuildDataSource qbds;
QueryBuildRange vehicleVendorFuelFilter;
;
sysTableLookup.addLookupfield(fieldnum(VehicleVendor, VendorId), true);
sysTableLookup.addLookupfield(fieldnum(VehicleVendor, VendorName));
qbds = query.addDataSource(tablenum(VehicleVendor));
switch (_vehicleVendorType)
{
case VehicleVendorType::Fuel:
qbds.addRange(fieldnum(VehicleVendor, IsFuelVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Mantienance:
qbds.addRange(fieldnum(VehicleVendor, IsMantenanceVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Manufacturer:
qbds.addRange(fieldnum(VehicleVendor, IsFuelVendor)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Tyre:
qbds.addRange(fieldnum(VehicleVendor, IsManufacturer)).value(queryValue(NoYes::Yes));
break;
case VehicleVendorType::Vehicle:
qbds.addRange(fieldnum(VehicleVendor, IsVehicleVendor)).value(queryValue(NoYes::Yes));
break;
}
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Overridden method of Vendor.VendorId on Vendor Datasource
public void lookup(FormControl _formControl, str _filterStr)
{
;
VehicleVendor::lookupVendor(_formControl, VehicleVendorType::Fuel);
}
Showing posts with label customized. Show all posts
Showing posts with label customized. Show all posts
Monday, March 24, 2008
Create Custom Lookups Dynamics AX
Thursday, August 23, 2007
Customized Form as Dialog Box
Scenario: I need to create a runbase dialog with saving options. I need to have a runbase calling a form present in AOT.
Answer: Override dialog method of runbase
public Object dialog()
{
FormRun dialogForm;
Args args = new Args(formstr(CustVendPaymProposalModPaymAttribDialog));
;
args.caller(this);
dialogForm = classfactory.formRunClass(args);
dialogForm.init();
return dialogForm;
}
CustVendPaymProposalModPaymAttribDialog is the dialog form which was created in order to
facilitate the design.
Answer: Override dialog method of runbase
public Object dialog()
{
FormRun dialogForm;
Args args = new Args(formstr(CustVendPaymProposalModPaymAttribDialog));
;
args.caller(this);
dialogForm = classfactory.formRunClass(args);
dialogForm.init();
return dialogForm;
}
CustVendPaymProposalModPaymAttribDialog is the dialog form which was created in order to
facilitate the design.
Customized auto report dynamics ax
Scenario: Can we have auto reports in dynamics ax.
Answer: You can not have customized auto reports in dynamics ax.
Answer: You can not have customized auto reports in dynamics ax.
Subscribe to:
Posts (Atom)