Hi Friends,
We want to add a lookup of the vendor master when we create the expense report in EP. Can we do that?
*This post is locked for comments
Hi,
Well, there are some ways you can achieve this goal, by create a custom lookup in user control, or by create/ change the lookup in AX.
If the lookup only changes the report, in some cases, you only need to change the report configuration or class.
Take a look in page 28, 57, 67 ,132 for some examples and explanations:
Microsoft Dynamics AX 2012 White Paper: Enterprise Portal Development Cookbook
If you need more help, please, explain more your problem, with more detail.
I Hope this Helps!
Regards,
Rodolfo Recalde.
Yes, you can write a lookup method on web control, something like below -
Note - This is NOT for vendor drop down.
protected void Account_Lookup(object sender, AxLookupEventArgs e) { AxLookup lookup = e.LookupControl;
// Create the lookup dataset - we will do a lookup in the Contact person table using (BCProxy.SysDataSetBuilder sysDataSetBuilder = BCProxy.SysDataSetBuilder.constructLookupDataSet( this.AxSession.AxaptaAdapter, TableMetadata.TableNum(this.AxSession, "VendBankAccount"))) { // Set the run time generated data set as the lookup data set lookup.LookupDataSet = new Microsoft.Dynamics.AX.Framework.Portal.Data.DataSet(this.AxSession, sysDataSetBuilder.toDataSet()); }
BCProxy.Query query = lookup.LookupDataSet.DataSetViews[0].MasterDataSource.query(); query.allowCrossCompany = true; query.addCompanyRange(GetCompanyLine()); using (BCProxy.QueryBuildDataSource qbds = query.dataSourceNo(1)) { using (BCProxy.QueryBuildRange range = qbds.addRange(TableDataFieldMetadata.FieldNum("VendBankAccount", "VendAccount"))) { DataSetViewRow PaymentLine = this.dsEPPaymentEdit.GetDataSourceView("PaymentLine").DataSetView.GetCurrent(); if (PaymentLine != null) { using (IAxaptaRecordAdapter record = asuPaymentLine.GetRecord()) { if (record != null) { AppProxy.VendTable vendTable = AppProxy.VendTable.findByCompany((string)record.GetField("Company"),(string)record.GetField("Account")); // Filter the lookup range.value = Convert.ToString(vendTable.AccountNum); range.status = (int)BCProxy.RangeStatus.Hidden; } }
} } } lookup.LookupDataSet.Init();
// Specify the lookup fields used lookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, lookup.LookupDataSetViewMetadata.ViewFields["AccountId"])); lookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, lookup.LookupDataSetViewMetadata.ViewFields["Name"])); lookup.Fields.Add(AxBoundFieldFactory.Create(this.AxSession, lookup.LookupDataSetViewMetadata.ViewFields["AccountNum"]));
// Specify the select field lookup.SelectField = "AccountId"; }
#endregion
Call it as below -
<dynamics:AxBoundField DataField="Account" DataSet="EPPaymentTableEdit" DataSetView="PaymentLine" SortExpression="Account" AutoPostBack="true" OnDataChanged="Account_DataChanged" LookupButtonDisplaySettings="Always" OnLookup="Account_Lookup"> </dynamics:AxBoundField>
You can override dataSetLookup on dataset as well.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Tocauer 4
Alexey Lekanov 3
Community Member 2