web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Customization on EP

(1) ShareShare
ReportReport
Posted on by 660

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

I have the same question (0)
  • Verified answer
    Rodolfo Recalde Profile Picture
    on at
    RE: Customization on EP

    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.

  • Verified answer
    Ajit Profile Picture
    8,755 on at
    RE: Customization on EP

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans